Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / websql / statement-error-callback.html
blob4ad4c77c502540d850a96dae5b5e52f8c752c849
1 <html>
2 <head>
3 <script>
5 function log(message)
7 document.getElementById("console").innerHTML += message + "<br>";
10 function finishTest()
12 log("Test Complete");
13 if (window.testRunner)
14 testRunner.notifyDone();
17 var txCallbackCount = 0;
18 var NUMBER_OF_TRANSACTIONS = 10;
19 var database;
21 function runTransaction(expectedToFail, statementErrorCallback)
23 database.transaction(function(tx) {
24 tx.executeSql("CREATE TABLE IF NOT EXISTS TestTable (RandomData TEXT)");
25 tx.executeSql("INSERT INTO TestTable VALUES (?)", ['test']);
26 tx.executeSql("THIS STATEMENT WILL FAIL", [],
27 function(tx, data) {
28 log("FAIL - this statement should have failed");
29 finishTest();
30 }, statementErrorCallback);
31 tx.executeSql("INSERT INTO TestTable VALUES (?)", ['test1'],
32 function(error) {
33 if (expectedToFail)
34 log("FAIL - This statement should not have been executed");
35 }, function() {
36 if (expectedToFail)
37 log("FAIL - This statement should not have been executed");
38 });
39 }, function(error) {
40 if (expectedToFail)
41 log("PASS - the transaction error callback was invoked.");
42 else
43 log("FAIL - the transaction error callback should not have been invoked.");
44 if (++txCallbackCount == NUMBER_OF_TRANSACTIONS)
45 finishTest();
46 }, function() {
47 if (expectedToFail)
48 log("FAIL - the transaction success callback should not have been invoked.");
49 else
50 log("PASS - the transaction success callback was invoked.");
51 if (++txCallbackCount == NUMBER_OF_TRANSACTIONS)
52 finishTest();
53 });
56 function runTest()
58 if (window.testRunner) {
59 testRunner.clearAllDatabases();
60 testRunner.dumpAsText();
61 testRunner.waitUntilDone();
64 database = openDatabase("StatementErrorCallbackTest", "1.0", "statement error callback test", 1024);
66 runTransaction(true, function(error) { return true; });
67 runTransaction(true, function(error) { throw "Exception in statement error callback"; return false; });
68 runTransaction(true, function(error) { return "some string"; });
69 runTransaction(true, function(error) { return 1234; });
70 runTransaction(true, function(error) { return {a: 2, b: "abc"}; });
71 runTransaction(true, function(error) { return "false"; });
72 runTransaction(false, function(error) {});
73 runTransaction(false, function(error) { return false; });
74 runTransaction(false, function(error) { return 0; });
75 runTransaction(false, function(error) { return null; });
78 </script>
79 </head>
81 <body onload="runTest()">
82 This test confirms that a transaction is immediately rolled back if and only if a statement's error callback throws an exception, returns true, or doesn't return any value.
83 <pre id="console">
84 </pre>
85 </body>
87 </html>