Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / index-count-expected.txt
blobbd739ae5052e8425b5702b5417ffb782b6e8abb5
1 Test IndexedDB's IDBIndex.count().
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "index-count.html"
7 indexedDB.deleteDatabase(dbname)
8 indexedDB.open(dbname)
9 store = db.createObjectStore('storeName', null)
10 store.createIndex('indexName', '')
11 PASS store.indexNames.contains('indexName') is true
12 adding 0 ... 99
14 verifying count without range
15 trans = db.transaction('storeName', 'readonly')
16 PASS trans is non-null.
17 store = trans.objectStore('storeName')
18 PASS store is non-null.
19 index = store.index('indexName')
20 PASS index is non-null.
21 request = index.count()
22 PASS typeof request.result is "number"
23 PASS request.result is 100
25 verifying count with range
26 trans = db.transaction('storeName', 'readonly')
27 PASS trans is non-null.
28 store = trans.objectStore('storeName')
29 PASS store is non-null.
30 index = trans.objectStore('storeName').index('indexName')
31 PASS index is non-null.
33 test = {"lower":0,"lowerOpen":false,"upper":99,"upperOpen":false,"expected":100}
34 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
35 PASS typeof request.result is "number"
36 PASS request.result is 100
38 test = {"lower":0,"lowerOpen":true,"upper":99,"upperOpen":false,"expected":99}
39 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
40 PASS typeof request.result is "number"
41 PASS request.result is 99
43 test = {"lower":0,"lowerOpen":false,"upper":99,"upperOpen":true,"expected":99}
44 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
45 PASS typeof request.result is "number"
46 PASS request.result is 99
48 test = {"lower":0,"lowerOpen":true,"upper":99,"upperOpen":true,"expected":98}
49 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
50 PASS typeof request.result is "number"
51 PASS request.result is 98
53 test = {"lower":0,"lowerOpen":false,"upper":100,"upperOpen":false,"expected":100}
54 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
55 PASS typeof request.result is "number"
56 PASS request.result is 100
58 test = {"lower":0,"lowerOpen":false,"upper":100,"upperOpen":false,"expected":100}
59 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
60 PASS typeof request.result is "number"
61 PASS request.result is 100
63 test = {"lower":10,"lowerOpen":false,"upper":100,"upperOpen":false,"expected":90}
64 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
65 PASS typeof request.result is "number"
66 PASS request.result is 90
68 test = {"lower":0,"lowerOpen":false,"upper":0,"upperOpen":false,"expected":1}
69 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
70 PASS typeof request.result is "number"
71 PASS request.result is 1
73 test = {"lower":500,"lowerOpen":false,"upper":500,"upperOpen":false,"expected":0}
74 request = index.count(IDBKeyRange.bound(test.lower, test.upper, test.lowerOpen, test.upperOpen))
75 PASS typeof request.result is "number"
76 PASS request.result is 0
78 verifying count with key
79 trans = db.transaction('storeName', 'readonly')
80 PASS trans is non-null.
81 store = trans.objectStore('storeName')
82 PASS store is non-null.
83 index = trans.objectStore('storeName').index('indexName')
84 PASS index is non-null.
85 Expecting exception from index.count(NaN)
86 PASS Exception was thrown.
87 PASS code is 0
88 PASS ename is 'DataError'
89 Exception message: Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.
90 Expecting exception from index.count({})
91 PASS Exception was thrown.
92 PASS code is 0
93 PASS ename is 'DataError'
94 Exception message: Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.
95 Expecting exception from index.count(/regex/)
96 PASS Exception was thrown.
97 PASS code is 0
98 PASS ename is 'DataError'
99 Exception message: Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.
101 test = {"key":0,"expected":1}
102 request = index.count(test.key)
103 PASS typeof request.result is "number"
104 PASS request.result is 1
106 test = {"key":100,"expected":0}
107 request = index.count(test.key)
108 PASS typeof request.result is "number"
109 PASS request.result is 0
111 test = {"key":null,"expected":100}
112 request = index.count(test.key)
113 PASS typeof request.result is "number"
114 PASS request.result is 100
115 PASS successfullyParsed is true
117 TEST COMPLETE