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

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

Issue 10216002: Fix IDB pyauto tests on cros by preventing restore after restart (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 8 years, 8 months 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 | « chrome/test/data/indexeddb/version_change_crash.html ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/indexeddb/version_change_crash.js
diff --git a/chrome/test/data/indexeddb/version_change_crash.js b/chrome/test/data/indexeddb/version_change_crash.js
index c74846be40edbe640d36f8daccce8d1a8f59b924..3833c98960a59dbab3a9485476ecc09613dd0138 100644
--- a/chrome/test/data/indexeddb/version_change_crash.js
+++ b/chrome/test/data/indexeddb/version_change_crash.js
@@ -1,26 +1,9 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-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 unexpectedCompleteCallback()
+function test()
{
- document.title = 'fail - unexpected complete callback';
-}
-
-function test() {
if (document.location.hash === '#part1') {
testPart1();
} else if (document.location.hash === '#part2') {
@@ -28,11 +11,12 @@ function test() {
} else if (document.location.hash === '#part3') {
testPart3();
} else {
- document.title = 'fail';
+ result('fail - unexpected hash');
}
}
-function testPart1() {
+function testPart1()
+{
// Prepare the database, then exit normally
// Set version 1, create store1
@@ -50,14 +34,15 @@ function testPart1() {
db.createObjectStore('store1');
transaction.onabort = unexpectedAbortCallback;
transaction.oncomplete = function (e) {
- document.title = 'pass - part1 - complete';
+ result('pass - part1 - complete');
};
};
};
};
}
-function testPart2() {
+function testPart2()
+{
// Start a VERSION_CHANGE then crash
// Set version 2, twiddle stores and crash
@@ -73,7 +58,7 @@ function testPart2() {
transaction.oncomplete = unexpectedCompleteCallback;
var store = db.createObjectStore('store2');
- document.title = 'pass - part2 - crash me';
+ result('pass - part2 - crash me');
// Keep adding to the transaction so it can't commit
(function loop() { store.put(0, 0).onsuccess = loop; }());
@@ -81,7 +66,8 @@ function testPart2() {
};
}
-function testPart3() {
+function testPart3()
+{
// Validate that Part 2 never committed
// Check version
@@ -90,20 +76,20 @@ function testPart3() {
openreq.onsuccess = function(e) {
var db = openreq.result;
if (db.version !== '1') {
- document.title = 'fail - version incorrect';
+ result('fail - version incorrect');
return;
}
if (!db.objectStoreNames.contains('store1')) {
- document.title = 'fail - store1 does not exist';
+ result('fail - store1 does not exist');
return;
}
if (db.objectStoreNames.contains('store2')) {
- document.title = 'fail - store2 exists';
+ result('fail - store2 exists');
return;
}
- document.title = 'pass - part3 - rolled back';
+ result('pass - part3 - rolled back');
};
}
« no previous file with comments | « chrome/test/data/indexeddb/version_change_crash.html ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698