7 document
.body
.innerHTML
+= message
+ "<br>";
10 function terminateTest()
12 if (window
.testRunner
)
13 testRunner
.notifyDone();
16 function openTestDatabase()
18 return openDatabase("ReadTransactionsRunningConcurrentlyTest",
20 "Test to make sure that multiple read transactions on different DB handles to the same DB run concurrently.",
24 var readTransactionsInProgress
= 0;
27 function runReadTransaction(db
)
32 ++readTransactionsInProgress
;
33 if (readTransactionsInProgress
=== 2) {
34 log("Read transactions running concurrently.");
41 tx
.executeSql("SELECT ? AS zero", [0], spin
,
42 errorHandler("execute failed"));
45 errorHandler("Read transaction failed"),
47 readTransactionsInProgress
--;
48 if (readTransactionsInProgress
=== 0)
53 function errorHandler(message
) {
54 return function(error
) {
55 log(message
+ ": " + error
.message
);
61 if (window
.testRunner
) {
62 testRunner
.clearAllDatabases();
63 testRunner
.dumpAsText();
64 testRunner
.waitUntilDone();
68 var db1
= openTestDatabase();
69 var db2
= openTestDatabase();
72 tx
.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo int);");
74 errorHandler("Cannot create the Test table"),
76 runReadTransaction(db1
);
77 runReadTransaction(db2
);
79 } catch(err
) { log(err
); }
83 <body onload=
"runTest();">
84 This test tests that two read-only transactions on different handles to the same database run concurrently.
<br>