Skip to content

Commit

Permalink
Add test to reproduce BUG #209
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Brody committed Mar 17, 2015
1 parent d708b39 commit 0ddc599
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion test-www/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,6 @@
});
});

// XXX Brody TODO [BROKEN]: try closing the writer db handle before reading from the db reader handle.
test(suiteName + ' same database file with separate writer/reader db handles', function () {
var dbname = 'writer-reader-test.db';
var dbw = openDatabase(dbname, "1.0", "Demo", DEFAULT_SIZE);
Expand Down Expand Up @@ -1375,6 +1374,44 @@
});
});

// XXX BROKEN [BUG #209]:
if (!isWebSql) test(suiteName + ' close one of multiple db handle', function () {
var dbname = 'multi-handle-db-close-one.db';
var dbw = openDatabase(dbname, "1.0", "Demo", DEFAULT_SIZE);
var dbr = openDatabase(dbname, "1.0", "Demo", DEFAULT_SIZE);

stop(1);

dbw.transaction(function (tx) {
tx.executeSql('DROP TABLE IF EXISTS tt');
tx.executeSql('CREATE TABLE IF NOT EXISTS tt (test_data)');
tx.executeSql('INSERT INTO tt VALUES (?)', ['My-test-data']);
}, function(error) {
console.log("ERROR: " + error.message);
ok(false, error.message);
start(1);
}, function() {
dbw.close(function () {
// XXX dbr no longer working [BUG #209]:
dbr.readTransaction(function (tx) {
ok(false, "Behavior changed - please update this test");
tx.executeSql('SELECT test_data from tt', [], function (tx, result) {
equal(result.rows.item(0).test_data, 'My-test-data', 'read data from reader handle');
start(1);
});
}, function(error) {
console.log("ERROR reading db handle: " + error.message);
//ok(false, "ERROR reading db handle: " + error.message);
ok(true, "BUG REPRODUCED");
start(1);
});
}, function (error) {
ok(false, 'close error callback not to be called after database is closed');
start(1);
});
});
});

test(suiteName + ' same database file with multiple writer db handles', function () {
var dbname = 'multi-writer-test.db';
var dbw1 = openDatabase(dbname, "1.0", "Demo", DEFAULT_SIZE);
Expand Down

0 comments on commit 0ddc599

Please sign in to comment.