GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / test / data / indexeddb / transaction_get_test.js
blob0af15af447bf91a1a10c38b727ff0683a23c4c61
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.
5 function afterCommit()
7     try {
8         debug("Accessing a committed transaction should throw");
9         var store = transaction.objectStore('storeName');
10     } catch (e) {
11         exc = e;
12         shouldBe('exc.code', 'DOMException.INVALID_STATE_ERR');
13     }
14     done();
17 function nonExistingKey()
19     shouldBe("event.target.result", "undefined");
20     transaction.oncomplete = afterCommit;
23 function gotValue()
25     value = event.target.result;
26     shouldBeEqualToString('value', 'myValue');
29 function startTransaction()
31     debug("Using get in a transaction");
32     transaction = db.transaction('storeName');
33     //transaction.onabort = unexpectedErrorCallback;
34     store = transaction.objectStore('storeName');
35     shouldBeEqualToString("store.name", "storeName");
36     request = store.get('myKey');
37     request.onsuccess = gotValue;
38     request.onerror = unexpectedErrorCallback;
40     var emptyRequest = store.get('nonExistingKey');
41     emptyRequest.onsuccess = nonExistingKey;
42     emptyRequest.onerror = unexpectedErrorCallback;
45 function populateObjectStore()
47     db = event.target.result;
48     deleteAllObjectStores(db);
49     window.objectStore = db.createObjectStore('storeName');
50     var request = objectStore.add('myValue', 'myKey');
51     request.onerror = unexpectedErrorCallback;
54 function test() {
55   indexedDBTest(populateObjectStore, startTransaction);