Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
|
jsbell
2017/01/17 17:29:52
Can you declare the file encoding? This should be
Scott Hess - ex-Googler
2017/01/17 20:42:35
So the Windows version was a stress test, then?
I
| |
| 3 <script> | |
| 4 function log(message) | |
| 5 { | |
| 6 document.getElementById("console").innerHTML += message + "<br>"; | |
| 7 } | |
| 8 | |
| 9 function finishTest() | |
| 10 { | |
| 11 if (window.testRunner) | |
| 12 testRunner.notifyDone(); | |
| 13 } | |
| 14 | |
| 15 function runTest() | |
| 16 { | |
| 17 if (window.testRunner) { | |
| 18 testRunner.clearAllDatabases(); | |
| 19 testRunner.dumpAsText(); | |
| 20 testRunner.waitUntilDone(); | |
| 21 } | |
| 22 | |
| 23 var transactionsRun = 0; | |
| 24 | |
| 25 // Open database with utf-8 name. | |
|
jsbell
2017/01/17 17:29:52
nit: Non-ASCII
(it's not UTF-8 encoded by the tim
Scott Hess - ex-Googler
2017/01/17 20:42:35
Acknowledged.
| |
| 26 var db = openDatabase("¥£€$", "1.0", "utf8 db test", 1024 * 1024); | |
| 27 if (db) { | |
| 28 log("Database creation succeeded"); | |
| 29 } else { | |
| 30 log("Database creation failed"); | |
|
jsbell
2017/01/17 17:29:53
finishTest() and return here?
Scott Hess - ex-Googler
2017/01/17 20:42:35
Acknowledged. Restructured the if() to take advan
| |
| 31 } | |
| 32 | |
| 33 db.transaction(function(t) { | |
| 34 t.executeSql("DROP TABLE IF EXISTS t"); | |
| 35 t.executeSql("CREATE TABLE t (id INTEGER PRIMARY KEY, v TEXT)"); | |
| 36 t.executeSql("INSERT INTO t VALUES (1, 'hello')"); | |
| 37 t.executeSql("INSERT INTO t VALUES (2, 'world')"); | |
| 38 }, function(e) { | |
| 39 log("Update transaction failed: " + e.message); | |
| 40 finishTest(); | |
| 41 }, function() { | |
| 42 log("Update transaction succeeded"); | |
| 43 db.transaction(function(t) { | |
| 44 t.executeSql("SELECT * FROM t ORDER BY id", [], function (t, r) { | |
| 45 if (r.rows.length != 2) { | |
| 46 log("Wrong number of rows returned"); | |
| 47 finishTest(); | |
| 48 } else if (r.rows.item(0).id != 1) { | |
| 49 log("Unexpected row 0.id"); | |
| 50 finishTest(); | |
| 51 } else if (r.rows.item(0).v != 'hello') { | |
| 52 log("Unexpected row 0.v"); | |
| 53 finishTest(); | |
| 54 } else if (r.rows.item(1).id != 2) { | |
| 55 log("Unexpected row 1.id"); | |
| 56 finishTest(); | |
| 57 } else if (r.rows.item(1).v != 'world') { | |
| 58 log("Unexpected row 1.v"); | |
| 59 finishTest(); | |
| 60 } | |
| 61 }); | |
| 62 }, function(e) { | |
| 63 log("Read transaction failed: " + e.message); | |
| 64 finishTest(); | |
| 65 }, function() { | |
| 66 log("Read transaction succeeded"); | |
| 67 finishTest(); | |
| 68 }); | |
| 69 }); | |
| 70 } | |
| 71 | |
| 72 </script> | |
| 73 </head> | |
| 74 | |
| 75 <body onload="runTest()"> | |
| 76 Test openDatabase() with name outside the ASCII set. | |
| 77 <pre id="console"> | |
| 78 </pre> | |
| 79 </body> | |
| 80 | |
| 81 </html> | |
| OLD | NEW |