Skip to content

Commit

Permalink
Update null char & error tests for Android Lollipop vs KitKat
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed Nov 8, 2017
1 parent eeab860 commit 98dc352
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
56 changes: 40 additions & 16 deletions spec/www/spec/db-tx-error-handling-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3181,6 +3181,7 @@ var mytests = function() {
it(suiteName + 'Inline US-ASCII blank string test with arguments array=function (BOGUS) in a try-catch block [TBD (WebKit) Web SQL vs plugin]', function(done) {
var db = openDatabase("Inline-US-ASCII-string-test-with-arguments-array-equals-function.db", "1.0", "Demo", DEFAULT_SIZE);

var check1 = false;
db.transaction(function(transaction) {
try {
transaction.executeSql("SELECT ''", function(ignored1, ignored2) {
Expand All @@ -3199,22 +3200,27 @@ var mytests = function() {
return true;
});
} catch(ex) {
// NOT EXPECTED for (WebKit) Web SQL or plugin:
expect(false).toBe(true);
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--');
check1 = true;
expect(ex).toBeDefined();
expect(ex.code).toBeDefined();
// expect(ex.code).toBeDefined();
expect(ex.message).toBeDefined();
throw ex;
}

}, function(error) {
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent)))
expect(check1).toBe(true);
expect(error).toBeDefined();
expect(error.code).toBeDefined();
expect(error.message).toBeDefined();
expect(error.code).toBe(0);
expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);
// TBD ???:
// expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);

// Close (plugin only) & finish:
(isWebSql) ? done() : db.close(done, done);
Expand All @@ -3230,6 +3236,7 @@ var mytests = function() {
it(suiteName + 'Inline US-ASCII blank string test with arguments array=function (BOGUS) in a try-catch block read tx [TBD (WebKit) Web SQL vs plugin]', function(done) {
var db = openDatabase("Inline-US-ASCII-string-test-with-arguments-array-equals-function-read-tx.db", "1.0", "Demo", DEFAULT_SIZE);

var check1 = false;
db.readTransaction(function(readTransaction) {
try {
readTransaction.executeSql("SELECT ''", function(ignored1, ignored2) {
Expand All @@ -3248,22 +3255,27 @@ var mytests = function() {
return true;
});
} catch(ex) {
// NOT EXPECTED for (WebKit) Web SQL or plugin:
expect(false).toBe(true);
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--');
check1 = true;
expect(ex).toBeDefined();
expect(ex.code).toBeDefined();
// expect(ex.code).toBeDefined();
expect(ex.message).toBeDefined();
throw ex;
}

}, function(error) {
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent)))
expect(check1).toBe(true);
expect(error).toBeDefined();
expect(error.code).toBeDefined();
expect(error.message).toBeDefined();
expect(error.code).toBe(0);
expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);
// TBD ???:
// expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);

// Close (plugin only) & finish:
(isWebSql) ? done() : db.close(done, done);
Expand All @@ -3279,6 +3291,7 @@ var mytests = function() {
it(suiteName + 'SELECT ? test with arguments array=function (BOGUS) in a try-catch block [TBD (WebKit) Web SQL vs plugin]', function(done) {
var db = openDatabase("SELECT-parameter-with-arguments-array-equals-function.db", "1.0", "Demo", DEFAULT_SIZE);

var check1 = false;
db.transaction(function(transaction) {
try {
transaction.executeSql("SELECT ?", function(ignored1, ignored2) {
Expand All @@ -3297,22 +3310,27 @@ var mytests = function() {
return true;
});
} catch(ex) {
// NOT EXPECTED for (WebKit) Web SQL or plugin:
expect(false).toBe(true);
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--');
check1 = true;
expect(ex).toBeDefined();
expect(ex.code).toBeDefined();
// expect(ex.code).toBeDefined();
expect(ex.message).toBeDefined();
throw ex;
}

}, function(error) {
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent)))
expect(check1).toBe(true);
expect(error).toBeDefined();
expect(error.code).toBeDefined();
expect(error.message).toBeDefined();
expect(error.code).toBe(0);
expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);
// TBD ???:
// expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);

// Close (plugin only) & finish:
(isWebSql) ? done() : db.close(done, done);
Expand All @@ -3328,6 +3346,7 @@ var mytests = function() {
it(suiteName + 'SELECT ? test with arguments array=function (BOGUS) in a try-catch block read tx [TBD (WebKit) Web SQL vs plugin]', function(done) {
var db = openDatabase("SELECT-parameter-with-arguments-array-equals-function-read-tx.db", "1.0", "Demo", DEFAULT_SIZE);

var check1 = false;
db.readTransaction(function(transaction) {
try {
transaction.executeSql("SELECT ?", function(ignored1, ignored2) {
Expand All @@ -3346,22 +3365,27 @@ var mytests = function() {
return true;
});
} catch(ex) {
// NOT EXPECTED for (WebKit) Web SQL or plugin:
expect(false).toBe(true);
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--');
check1 = true;
expect(ex).toBeDefined();
expect(ex.code).toBeDefined();
// expect(ex.code).toBeDefined();
expect(ex.message).toBeDefined();
throw ex;
}

}, function(error) {
// EXPECTED RESULT for (WebKit) Web SQL ONLY:
if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--');
if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent)))
expect(check1).toBe(true);
expect(error).toBeDefined();
expect(error.code).toBeDefined();
expect(error.message).toBeDefined();
expect(error.code).toBe(0);
expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);
// TBD ???:
// expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/);

// Close (plugin only) & finish:
(isWebSql) ? done() : db.close(done, done);
Expand Down
5 changes: 1 addition & 4 deletions spec/www/spec/db-tx-value-bindings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,10 +1324,7 @@ var mytests = function() {
// we would like to know, so the test is coded to fail if it starts
// working there.

if (isWebSql) {
expect(name.length).toBe(1);
expect(name).toBe('a');
} else if (isWindows) {
if (isWindows || (isWebSql && !(/Android [5-9]/.test(navigator.userAgent)))) {
expect(name.length).toBe(1);
expect(name).toBe('a');
} else {
Expand Down

0 comments on commit 98dc352

Please sign in to comment.