Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / websql / change-version.html
blobb82527b9cb73c596195505ec01873dfc89fad0ba
1 <html>
2 <head>
3 <title>Test database.changeVersion</title>
4 <script>
5 var db1;
6 var EXPECTED_VERSION_AFTER_HIXIE_TEST = '2';
7 var EXPECTED_VERSION_AFTER_RELOAD = '3';
9 function emptyFunction() { }
11 function changeVersionCallback(tx)
13 tx.executeSql("DROP table if exists info;", [], emptyFunction, emptyFunction);
14 tx.executeSql("CREATE table if not exists info (version INTEGER);", [], emptyFunction, emptyFunction);
15 tx.executeSql("INSERT into info values(?);", [EXPECTED_VERSION_AFTER_RELOAD], emptyFunction, emptyFunction);
18 function changeVersionSuccess()
20 log("Successfully changed version to " + db1.version + ". Reloading.");
21 window.location.href = window.location + '?2';
24 function changeVersionError(error)
26 log("Error: " + error.message);
27 finishTest();
30 function finishTest()
32 if (window.testRunner)
33 testRunner.notifyDone();
34 log("TEST COMPLETE");
37 function log(message)
39 document.getElementById("console").innerText += message + "\n";
42 function runTest()
44 if (window.location.search == "?2") {
45 db1 = window.openDatabase("changeversion-test", "", "Test for the database.changeVersion() function", 1024);
46 log("Finished tests with version " + db1.version + "; expected version: " + EXPECTED_VERSION_AFTER_RELOAD);
48 // Reset the DB version or the next run might fail.
49 db1.changeVersion(db1.version, "1");
51 finishTest();
52 } else
53 testPart1();
56 function testPart1() {
57 if (window.testRunner) {
58 testRunner.clearAllDatabases();
59 testRunner.dumpAsText();
60 testRunner.waitUntilDone();
63 db1 = window.openDatabase("changeversion-test", "1", "Test for the database.changeVersion() function", 1024);
64 var db2 = window.openDatabase("changeversion-test", "1", "Test for the database.changeVersion() function", 1024);
66 // First run Hixie's test to ensure basic changeVersion functionality works (see bug 28418).
67 db1.changeVersion("1", EXPECTED_VERSION_AFTER_HIXIE_TEST, null, function (e) {
68 log("FAIL in changeVersion:" + e);
69 finishTest();
70 }, function () {
71 // Make sure the version change has propagated to db2 too.
72 // All transactions on db2 should fail.
73 if (db2.version != db1.version) {
74 log("FAIL: changing db1's version (" + db1.version + ") did not change db2's version (" + db2.version + ") as expected.");
75 finishTest();
77 db2.transaction(function(tx) {
78 tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)");
79 }, function(error) { }, function() {
80 log("FAIL: The DB version changed, all transactions on db2 should fail.");
81 finishTest();
82 });
84 // Make sure any new handle to the same DB sees the new version
85 try {
86 var db3 = openDatabase("change-version-test", EXPECTED_VERSION_AFTER_HIXIE_TEST, "", 0);
87 } catch (e) {
88 log("FAIL in openDatabase: " + e);
89 finishTest();
91 if (db1.version != db3.version) {
92 log("FAIL: db.version(" + db1.version + ") does not match db3.version(" + db3.version +")");
93 finishTest();
96 // Now try a test to ensure the version persists after reloading (see bug 27836)
97 db1.changeVersion(EXPECTED_VERSION_AFTER_HIXIE_TEST, EXPECTED_VERSION_AFTER_RELOAD, changeVersionCallback, changeVersionError, changeVersionSuccess);
98 });
100 </script>
101 </head>
102 <body onload="runTest();">
103 This test verifies that the JS database.changeVersion() function works as expected.
104 <pre id="console"></pre>
105 </body>
106 </html>