OLD | NEW |
1 // Copyright (c) 2012 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 var testDate = new Date("February 24, 1955 12:00:00"); | 5 var testDate = new Date("February 24, 1955 12:00:00"); |
6 | 6 |
7 function getByDateSuccess() | 7 function getByDateSuccess() |
8 { | 8 { |
9 debug('Data retrieved by date key'); | 9 debug('Data retrieved by date key'); |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 debug('More data added'); | 59 debug('More data added'); |
60 | 60 |
61 var request = objectStore.get(1); | 61 var request = objectStore.get(1); |
62 request.onsuccess = getSuccess; | 62 request.onsuccess = getSuccess; |
63 request.onerror = unexpectedErrorCallback; | 63 request.onerror = unexpectedErrorCallback; |
64 } | 64 } |
65 | 65 |
66 function addWithSameKeyFailed() | 66 function addWithSameKeyFailed() |
67 { | 67 { |
68 debug('Adding a record with same key failed'); | 68 debug('Adding a record with same key failed'); |
69 shouldBe("event.target.errorCode", | |
70 "webkitIDBDatabaseException.CONSTRAINT_ERR"); | |
71 shouldBe("event.target.error.name", "'ConstraintError'"); | 69 shouldBe("event.target.error.name", "'ConstraintError'"); |
72 event.preventDefault(); | 70 event.preventDefault(); |
73 | 71 |
74 var request = transaction.objectStore('stuff').add('foo', testDate); | 72 var request = transaction.objectStore('stuff').add('foo', testDate); |
75 request.onsuccess = moreDataAddedSuccess; | 73 request.onsuccess = moreDataAddedSuccess; |
76 request.onerror = unexpectedErrorCallback; | 74 request.onerror = unexpectedErrorCallback; |
77 } | 75 } |
78 | 76 |
79 function dataAddedSuccess() | 77 function dataAddedSuccess() |
80 { | 78 { |
(...skipping 24 matching lines...) Expand all Loading... |
105 shouldBe("objectStore.indexNames[1]", "'lname_index'"); | 103 shouldBe("objectStore.indexNames[1]", "'lname_index'"); |
106 | 104 |
107 var request = objectStore.add({fname: "John", lname: "Doe", id: 1}); | 105 var request = objectStore.add({fname: "John", lname: "Doe", id: 1}); |
108 request.onsuccess = dataAddedSuccess; | 106 request.onsuccess = dataAddedSuccess; |
109 request.onerror = unexpectedErrorCallback; | 107 request.onerror = unexpectedErrorCallback; |
110 } | 108 } |
111 | 109 |
112 function test() { | 110 function test() { |
113 indexedDBTest(populateObjectStore); | 111 indexedDBTest(populateObjectStore); |
114 } | 112 } |
OLD | NEW |