Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Unified Diff: chrome/test/data/indexeddb/bug_90635.js

Issue 8892021: Try to address flaxy IndexedDB pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't need lambda expressions Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/indexeddb/version_change_crash.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/indexeddb/bug_90635.js
diff --git a/chrome/test/data/indexeddb/bug_90635.js b/chrome/test/data/indexeddb/bug_90635.js
index dd2329987f1672024b7a58147a0b1737684a9a4e..e52254d70a83ce3773fb84bddb5726c7a48d5c86 100644
--- a/chrome/test/data/indexeddb/bug_90635.js
+++ b/chrome/test/data/indexeddb/bug_90635.js
@@ -5,46 +5,75 @@
window.indexedDB = window.indexedDB || window.webkitIndexedDB;
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction;
-window.testResult = '';
+function unexpectedErrorCallback()
+{
+ document.title = 'fail - unexpected error callback';
+}
+function unexpectedAbortCallback()
+{
+ document.title = 'fail - unexpected abort callback';
+}
function test()
{
- var req = window.indexedDB.open('bug90635');
- req.onerror = function(e) {
- window.testResult = 'fail';
- };
- req.onsuccess = function(e) {
- var db = e.target.result;
- var VERSION = '1';
- if (db.version !== VERSION) {
- var ver = db.setVersion(VERSION);
- ver.onerror = function(e) {
- window.testResult = 'fail';
- };
- ver.onsuccess = function(e) {
+ if (document.location.hash === '#part1') {
+ testPart1();
+ } else if (document.location.hash === '#part2') {
+ testPart2();
+ } else {
+ document.title = 'fail - no hash';
+ }
+}
+
+function testPart1()
+{
+ var delreq = window.indexedDB.deleteDatabase('bug90635');
+ delreq.onerror = unexpectedErrorCallback;
+ delreq.onsuccess = function() {
+ var openreq = window.indexedDB.open('bug90635');
+ openreq.onerror = unexpectedErrorCallback;
+ openreq.onsuccess = function(e) {
+ var db = openreq.result;
+ var setverreq = db.setVersion('1');
+ setverreq.onerror = unexpectedErrorCallback;
+ setverreq.onsuccess = function(e) {
+ var transaction = setverreq.result;
+
db.createObjectStore('store1');
db.createObjectStore('store2', {keyPath: ''});
db.createObjectStore('store3', {keyPath: 'some_path'});
- test_store(db, 'first run');
+
+ transaction.onabort = unexpectedAbortCallback;
+ transaction.oncomplete = function() {
+ test_store(db, 'first run');
+ };
};
- } else {
- test_store(db, 'second run');
- }
+ };
};
+}
+
+function testPart2()
+{
+ var openreq = window.indexedDB.open('bug90635');
+ openreq.onerror = unexpectedErrorCallback;
+ openreq.onsuccess = function(e) {
+ var db = openreq.result;
+ test_store(db, 'second run');
+ };
+}
+
+function test_store(db, msg) {
+ var transaction = db.transaction(['store1', 'store2', 'store3'],
+ IDBTransaction.READ_ONLY);
+ var store1 = transaction.objectStore('store1');
+ var store2 = transaction.objectStore('store2');
+ var store3 = transaction.objectStore('store3');
- function test_store(db, msg) {
- var transaction = db.transaction(['store1', 'store2', 'store3'],
- IDBTransaction.READ_ONLY);
- var store1 = transaction.objectStore('store1');
- var store2 = transaction.objectStore('store2');
- var store3 = transaction.objectStore('store3');
-
- if (store1.keyPath !== null ||
- store2.keyPath !== '' ||
- store3.keyPath !== 'some_path') {
- window.testResult = 'fail - ' + msg;
- } else {
- window.testResult = 'pass - ' + msg;
- }
+ if (store1.keyPath !== null ||
+ store2.keyPath !== '' ||
+ store3.keyPath !== 'some_path') {
+ document.title = 'fail - ' + msg;
+ } else {
+ document.title = 'pass - ' + msg;
}
}
« no previous file with comments | « no previous file | chrome/test/data/indexeddb/version_change_crash.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698