base/threading: remove ScopedTracker placed for experiments
[chromium-blink-merge.git] / content / test / data / indexeddb / key_path_test.js
blob9ac61bf3fab9b0072ce7a2dc38cc8bec57b0aad0
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
3 // found in the LICENSE file.
6 function cursorSuccess()
8 debug("Cursor opened successfully.");
9 // FIXME: check that we can iterate the cursor.
10 shouldBe("event.target.result.direction", "'next'");
11 shouldBe("event.target.result.key", "'myKey' + count");
12 shouldBe("event.target.result.value.keyPath", "'myKey' + count");
13 shouldBe("event.target.result.value.value", "'myValue' + count");
14 if (++count >= 5)
15 done();
16 else
17 openCursor();
20 function openCursor()
22 debug("Opening cursor #" + count);
23 keyRange = IDBKeyRange.lowerBound("myKey" + count);
24 request = objectStore.openCursor(keyRange);
25 request.onsuccess = cursorSuccess;
26 request.onerror = unexpectedErrorCallback;
29 function populateObjectStore()
31 debug("Populating object store #" + count);
32 obj = {'keyPath': 'myKey' + count, 'value': 'myValue' + count};
33 request = objectStore.add(obj);
34 request.onerror = unexpectedErrorCallback;
35 if (++count >= 5) {
36 count = 0;
37 request.onsuccess = openCursor;
38 } else {
39 request.onsuccess = populateObjectStore;
43 function createObjectStore()
45 debug('createObjectStore');
46 db = event.target.result;
47 window.objectStore = db.createObjectStore('test', {keyPath: 'keyPath'});
48 count = 0;
49 populateObjectStore();
52 function test()
54 indexedDBTest(createObjectStore);