| <html> |
| <head> |
| <meta charset="utf-8"/> |
| <script> |
| function log(message) |
| { |
| document.getElementById("console").innerHTML += message + "<br>"; |
| } |
| |
| function finishTest() |
| { |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| function runTest() |
| { |
| if (window.testRunner) { |
| testRunner.clearAllDatabases(); |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| var transactionsRun = 0; |
| |
| // Open database with non-ASCII name. |
| var db = openDatabase("¥£€$", "1.0", "utf8 db test", 1024 * 1024); |
| if (!db) { |
| log("Database creation failed"); |
| finishTest(); |
| return |
| } |
| log("Database creation succeeded"); |
| |
| db.transaction(function(t) { |
| t.executeSql("DROP TABLE IF EXISTS t"); |
| t.executeSql("CREATE TABLE t (id INTEGER PRIMARY KEY, v TEXT)"); |
| t.executeSql("INSERT INTO t VALUES (1, 'hello')"); |
| t.executeSql("INSERT INTO t VALUES (2, 'world')"); |
| }, function(e) { |
| log("Update transaction failed: " + e.message); |
| finishTest(); |
| }, function() { |
| log("Update transaction succeeded"); |
| db.transaction(function(t) { |
| t.executeSql("SELECT * FROM t ORDER BY id", [], function (t, r) { |
| if (r.rows.length != 2) { |
| log("Wrong number of rows returned"); |
| finishTest(); |
| } else if (r.rows.item(0).id != 1) { |
| log("Unexpected row 0.id"); |
| finishTest(); |
| } else if (r.rows.item(0).v != 'hello') { |
| log("Unexpected row 0.v"); |
| finishTest(); |
| } else if (r.rows.item(1).id != 2) { |
| log("Unexpected row 1.id"); |
| finishTest(); |
| } else if (r.rows.item(1).v != 'world') { |
| log("Unexpected row 1.v"); |
| finishTest(); |
| } |
| }); |
| }, function(e) { |
| log("Read transaction failed: " + e.message); |
| finishTest(); |
| }, function() { |
| log("Read transaction succeeded"); |
| finishTest(); |
| }); |
| }); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| Test openDatabase() with name outside the ASCII set. |
| <pre id="console"> |
| </pre> |
| </body> |
| |
| </html> |