Skip to content

Commit ef01b33

Browse files
committed
Workarounds for js tests in Safari.
On behalf of juangj
1 parent 1fd03d5 commit ef01b33

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

javascript/atoms/test/html5/database_test.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
try {
3434
var win = bot.getWindow();
35-
var db = win.openDatabase('testDB', '1.0', 'db name', 5 * 1024 * 1024);
35+
// Keep the DB size below 5 MB. Above that size, Safari will prompt
36+
// for permission and cause this test to hang.
37+
var db = win.openDatabase('testDB', '1.0', 'db name', 2 * 1024 * 1024);
3638
db.transaction(function(tx) {
3739
tx.executeSql('CREATE TABLE IF NOT EXISTS docids (id INTEGER ' +
3840
'PRIMARY KEY, name TEXT, owner TEXT)');

javascript/webdriver/test/atoms/inject/sql_database_test.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
}
2525
return new goog.Promise(function(success, fail) {
2626
var win = bot.getWindow();
27-
var db = win.openDatabase('testDB', '1.0', 'db name', 5*1024*1024);
27+
// Keep the DB size below 5 MB. Above that size, Safari will prompt for
28+
// permission and cause this test to hang.
29+
var db = win.openDatabase('testDB', '1.0', 'db name', 2 * 1024 * 1024);
2830
db.transaction(function(tx) {
2931
tx.executeSql('CREATE TABLE IF NOT EXISTS docids (id INTEGER \
3032
PRIMARY KEY, name TEXT, owner TEXT)');

javascript/webdriver/test/promise_error_test.js

+24
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ goog.require('goog.Promise');
2727
goog.require('goog.async.run');
2828
goog.require('goog.testing.jsunit');
2929
goog.require('goog.userAgent');
30+
goog.require('goog.userAgent.product');
3031
goog.require('webdriver.promise');
3132
goog.require('webdriver.test.testutil');
3233

@@ -40,6 +41,13 @@ var StubError = webdriver.test.testutil.StubError,
4041
var flow, uncaughtExceptions;
4142

4243

44+
function longStackTracesAreBroken() {
45+
// Safari 8.0 is "Safari/538.35.8" in the user agent.
46+
return goog.userAgent.product.SAFARI &&
47+
!goog.userAgent.isVersionOrHigher(538);
48+
}
49+
50+
4351
function shouldRunTests() {
4452
return !goog.userAgent.IE || goog.userAgent.isVersionOrHigher(10);
4553
}
@@ -477,6 +485,10 @@ function testFailsParentTaskIfAsyncScheduledTaskFails() {
477485

478486

479487
function testLongStackTraces_alwaysIncludesTaskStacksInFailures() {
488+
if (longStackTracesAreBroken()) {
489+
return;
490+
}
491+
480492
webdriver.promise.LONG_STACK_TRACES = false;
481493
flow.execute(function() {
482494
flow.execute(function() {
@@ -503,6 +515,10 @@ function testLongStackTraces_alwaysIncludesTaskStacksInFailures() {
503515

504516

505517
function testLongStackTraces_doesNotIncludeCompletedTasks() {
518+
if (longStackTracesAreBroken()) {
519+
return;
520+
}
521+
506522
flow.execute(goog.nullFunction, 'succeeds');
507523
flow.execute(throwStubError, 'kaboom').then(fail, function(e) {
508524
assertIsStubError(e);
@@ -520,6 +536,10 @@ function testLongStackTraces_doesNotIncludeCompletedTasks() {
520536

521537

522538
function testLongStackTraces_doesNotIncludePromiseChainWhenDisabled() {
539+
if (longStackTracesAreBroken()) {
540+
return;
541+
}
542+
523543
webdriver.promise.LONG_STACK_TRACES = false;
524544
flow.execute(function() {
525545
flow.execute(function() {
@@ -548,6 +568,10 @@ function testLongStackTraces_doesNotIncludePromiseChainWhenDisabled() {
548568

549569

550570
function testLongStackTraces_includesPromiseChainWhenEnabled() {
571+
if (longStackTracesAreBroken()) {
572+
return;
573+
}
574+
551575
webdriver.promise.LONG_STACK_TRACES = true;
552576
flow.execute(function() {
553577
flow.execute(function() {

0 commit comments

Comments
 (0)