- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / workers / storage / resources / open-database-creation-callback-sync.js
1 var creationCallbackCalled1 = false;
2 var db1Name = "OpenDatabaseCreationCallback1" + (new Date()).getTime();
3 var db2Name = "OpenDatabaseCreationCallback2" + (new Date()).getTime();
4 var db1 = openDatabaseSync(db1Name, "1.0", "", 1,
5                            function(db) {
6                                postMessage("PASS: Creation callback was called.");
7                                if (db.version != "")
8                                    postMessage("FAIL: Wrong version " + db.version + "; empty string expected.");
9                                else
10                                    postMessage("PASS: Version set to empty string as expected.");
11                            });
12
13 var db1Fail = null;
14 try {
15     db1Fail = openDatabaseSync(db1Name, "1.0", "", 1);
16     postMessage("FAIL: An INVALID_STATE_ERR exception should've been thrown.");
17 } catch(err) {
18     if (db1Fail)
19         postMessage("FAIL: db1Fail should have been null.");
20     else
21         postMessage("PASS: An exception was thrown and db1Fail is null as expected.");
22 }
23
24 // Open a handle to another database, first without a creation callback, then with one.
25 // Make sure the creation callback is not called.
26 var db2 = openDatabaseSync(db2Name, "1.0", "", 1);
27 db2 = openDatabaseSync(db2Name, "1.0", "", 1, function(db) { postMessage("FAIL: Creation callback should not have been called."); });
28
29 postMessage("done");