OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 window.indexedDB = window.indexedDB || window.webkitIndexedDB; | |
6 window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction; | |
7 | |
8 function unexpectedErrorCallback() | |
9 { | |
10 document.title = 'fail - unexpected error callback'; | |
11 } | |
12 function unexpectedAbortCallback() | |
13 { | |
14 document.title = 'fail - unexpected abort callback'; | |
15 } | |
16 | |
17 function test() | 5 function test() |
18 { | 6 { |
19 if (document.location.hash === '#part1') { | 7 if (document.location.hash === '#part1') { |
20 testPart1(); | 8 testPart1(); |
21 } else if (document.location.hash === '#part2') { | 9 } else if (document.location.hash === '#part2') { |
22 testPart2(); | 10 testPart2(); |
23 } else { | 11 } else { |
24 document.title = 'fail - no hash'; | 12 result('fail - unexpected hash'); |
25 } | 13 } |
26 } | 14 } |
27 | 15 |
28 function testPart1() | 16 function testPart1() |
29 { | 17 { |
30 var delreq = window.indexedDB.deleteDatabase('bug90635'); | 18 var delreq = window.indexedDB.deleteDatabase('bug90635'); |
31 delreq.onerror = unexpectedErrorCallback; | 19 delreq.onerror = unexpectedErrorCallback; |
32 delreq.onsuccess = function() { | 20 delreq.onsuccess = function() { |
33 var openreq = window.indexedDB.open('bug90635'); | 21 var openreq = window.indexedDB.open('bug90635'); |
34 openreq.onerror = unexpectedErrorCallback; | 22 openreq.onerror = unexpectedErrorCallback; |
(...skipping 30 matching lines...) Expand all Loading... |
65 function test_store(db, msg) { | 53 function test_store(db, msg) { |
66 var transaction = db.transaction(['store1', 'store2', 'store3'], | 54 var transaction = db.transaction(['store1', 'store2', 'store3'], |
67 IDBTransaction.READ_ONLY); | 55 IDBTransaction.READ_ONLY); |
68 var store1 = transaction.objectStore('store1'); | 56 var store1 = transaction.objectStore('store1'); |
69 var store2 = transaction.objectStore('store2'); | 57 var store2 = transaction.objectStore('store2'); |
70 var store3 = transaction.objectStore('store3'); | 58 var store3 = transaction.objectStore('store3'); |
71 | 59 |
72 if (store1.keyPath !== null || | 60 if (store1.keyPath !== null || |
73 store2.keyPath !== '' || | 61 store2.keyPath !== '' || |
74 store3.keyPath !== 'some_path') { | 62 store3.keyPath !== 'some_path') { |
75 document.title = 'fail - ' + msg; | 63 result('fail - ' + msg); |
76 } else { | 64 } else { |
77 document.title = 'pass - ' + msg; | 65 result('pass - ' + msg); |
78 } | 66 } |
79 } | 67 } |
OLD | NEW |