Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/storage/websql/open-database-utf8-name.html |
| diff --git a/third_party/WebKit/LayoutTests/storage/websql/open-database-utf8-name.html b/third_party/WebKit/LayoutTests/storage/websql/open-database-utf8-name.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..21b85763490310bac1792464a6ce0b235aa39299 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/storage/websql/open-database-utf8-name.html |
| @@ -0,0 +1,81 @@ |
| +<html> |
| +<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
|
| +<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 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.
|
| + var db = openDatabase("¥£€$", "1.0", "utf8 db test", 1024 * 1024); |
| + if (db) { |
| + log("Database creation succeeded"); |
| + } else { |
| + 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
|
| + } |
| + |
| + 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> |