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