OLD | NEW |
1 if (this.importScripts) { | 1 if (this.importScripts) { |
2 importScripts('../../../resources/js-test.js'); | 2 importScripts('../../../resources/js-test.js'); |
3 importScripts('shared.js'); | 3 importScripts('shared.js'); |
4 } | 4 } |
5 | 5 |
6 description("Test transaction aborts send the proper onabort messages.."); | 6 description("Test transaction aborts send the proper onabort messages.."); |
7 | 7 |
8 indexedDBTest(prepareDatabase, startTest); | 8 indexedDBTest(prepareDatabase, startTest); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 17 matching lines...) Expand all Loading... |
28 request.onsuccess = unexpectedSuccessCallback; | 28 request.onsuccess = unexpectedSuccessCallback; |
29 trans.abort(); | 29 trans.abort(); |
30 | 30 |
31 firstError = false; | 31 firstError = false; |
32 secondError = false; | 32 secondError = false; |
33 abortFired = false; | 33 abortFired = false; |
34 } | 34 } |
35 | 35 |
36 function firstAdd() | 36 function firstAdd() |
37 { | 37 { |
| 38 expectError(); |
38 shouldBe("event.target.error.name", "'AbortError'"); | 39 shouldBe("event.target.error.name", "'AbortError'"); |
39 shouldBeNull("trans.error"); | 40 shouldBeNull("trans.error"); |
40 shouldBeFalse("firstError"); | 41 shouldBeFalse("firstError"); |
41 shouldBeFalse("secondError"); | 42 shouldBeFalse("secondError"); |
42 shouldBeFalse("abortFired"); | 43 shouldBeFalse("abortFired"); |
43 firstError = true; | 44 firstError = true; |
44 | 45 |
45 evalAndExpectException("store.add({x: 'value4', y: 'zzz4'}, 'key4')", "0", "
'TransactionInactiveError'"); | 46 evalAndExpectException("store.add({x: 'value4', y: 'zzz4'}, 'key4')", "0", "
'TransactionInactiveError'"); |
46 } | 47 } |
47 | 48 |
48 function secondAdd() | 49 function secondAdd() |
49 { | 50 { |
| 51 expectError(); |
50 shouldBe("event.target.error.name", "'AbortError'"); | 52 shouldBe("event.target.error.name", "'AbortError'"); |
51 shouldBeNull("trans.error"); | 53 shouldBeNull("trans.error"); |
52 shouldBeTrue("firstError"); | 54 shouldBeTrue("firstError"); |
53 shouldBeFalse("secondError"); | 55 shouldBeFalse("secondError"); |
54 shouldBeFalse("abortFired"); | 56 shouldBeFalse("abortFired"); |
55 secondError = true; | 57 secondError = true; |
56 } | 58 } |
57 | 59 |
58 function transactionAborted() | 60 function transactionAborted() |
59 { | 61 { |
60 shouldBeTrue("firstError"); | 62 shouldBeTrue("firstError"); |
61 shouldBeTrue("secondError"); | 63 shouldBeTrue("secondError"); |
62 shouldBeFalse("abortFired"); | 64 shouldBeFalse("abortFired"); |
63 shouldBeNull("trans.error"); | 65 shouldBeNull("trans.error"); |
64 abortFired = true; | 66 abortFired = true; |
65 | 67 |
66 evalAndExpectException("store.add({x: 'value5', y: 'zzz5'}, 'key5')", "0", "
'TransactionInactiveError'"); | 68 evalAndExpectException("store.add({x: 'value5', y: 'zzz5'}, 'key5')", "0", "
'TransactionInactiveError'"); |
67 | 69 |
68 evalAndExpectException("trans.abort()", "DOMException.INVALID_STATE_ERR", "'
InvalidStateError'"); | 70 evalAndExpectException("trans.abort()", "DOMException.INVALID_STATE_ERR", "'
InvalidStateError'"); |
69 | 71 |
70 finishJSTest(); | 72 finishJSTest(); |
71 } | 73 } |
OLD | NEW |