GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / test / data / indexeddb / transaction_run_forever.js
blobf6c65c0fec41300ca6baacf41bc7cedaa854d511
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 test()
7   // Do not use indexedDBTest() - need to specify the database name
8   var dbname = "doesnt-hang-test";
10   var request = indexedDB.deleteDatabase(dbname);
11   request.onerror = unexpectedErrorCallback;
12   request.onblocked = unexpectedBlockedCallback;
13   request.onsuccess = function() {
14     var request = indexedDB.open(dbname, 1);
15     request.onerror = unexpectedErrorCallback;
16     request.onblocked = unexpectedBlockedCallback;
17     request.onupgradeneeded = onUpgradeNeeded;
18     request.onsuccess = onOpenSuccess;
19   };
22 function onUpgradeNeeded()
24   // We are now in a set version transaction.
25   debug('Creating object store.');
26   var db = event.target.result;
27   db.createObjectStore('store');
31 var objectStore;
32 function onOpenSuccess()
34   var db = event.target.result;
36   debug('Creating new transaction.');
37   var transaction = db.transaction('store', 'readwrite');
38   transaction.oncomplete = unexpectedCompleteCallback;
39   transaction.onabort = unexpectedAbortCallback;
40   objectStore = transaction.objectStore('store');
42   debug('Starting endless loop...');
43   endlessLoop();
46 var loopCount = 0;
47 function endlessLoop()
49   var request = objectStore.get(0);
50   request.onsuccess = endlessLoop;
51   request.onerror = unexpectedErrorCallback;
53   loopCount += 1;
54   if (loopCount == 7) {
55     // If we've already looped 7 times, it's pretty safe to assume
56     // we'll continue looping for some time...
57     debug("Looping infinitely within a transaction.");
58     done();
59   }