OLD | NEW |
1 <script> | 1 <!-- |
2 chrome.test.runTests([function tab() { | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 // Check that the localstorage stuff we stored is still there. | 3 * source code is governed by a BSD-style license that can be found in the |
4 chrome.test.assertTrue(localStorage.foo == "bar"); | 4 * LICENSE file. |
5 | 5 --> |
6 // Check that the database stuff we stored is still there. | 6 <script src="tab.js"></script> |
7 try { | |
8 console.log("Opening database..."); | |
9 var db = window.openDatabase("mydb2", "1.0", "database test", 2048); | |
10 console.log("DONE opening database"); | |
11 } catch (err) { | |
12 console.log("Exception"); | |
13 console.log(err.message); | |
14 } | |
15 if (!db) | |
16 chrome.test.fail("failed to open database"); | |
17 | |
18 console.log("Performing transaction..."); | |
19 db.transaction(function(tx) { | |
20 tx.executeSql("select body from note", [], function(tx, results) { | |
21 chrome.test.assertTrue(results.rows.length == 1); | |
22 chrome.test.assertTrue(results.rows.item(0).body == "hotdog"); | |
23 chrome.test.succeed(); | |
24 }, function(tx, error) { | |
25 chrome.test.fail(error.message); | |
26 }); | |
27 }, function(error) { | |
28 chrome.test.fail(error.message); | |
29 }); | |
30 }]); | |
31 </script> | |
OLD | NEW |