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

Side by Side Diff: LayoutTests/storage/indexeddb/resources/shared.js

Issue 1317593005: Indexed DB: Remove vendor prefix removal from tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 var jsTestIsAsync = true; 1 var jsTestIsAsync = true;
2 if (self.importScripts && !self.postMessage) { 2 if (self.importScripts && !self.postMessage) {
3 // Shared worker. Make postMessage send to the newest client, which in 3 // Shared worker. Make postMessage send to the newest client, which in
4 // our tests is the only client. 4 // our tests is the only client.
5 5
6 // Store messages for sending until we have somewhere to send them. 6 // Store messages for sending until we have somewhere to send them.
7 self.postMessage = function(message) 7 self.postMessage = function(message)
8 { 8 {
9 if (typeof self.pendingMessages === "undefined") 9 if (typeof self.pendingMessages === "undefined")
10 self.pendingMessages = []; 10 self.pendingMessages = [];
11 self.pendingMessages.push(message); 11 self.pendingMessages.push(message);
12 }; 12 };
13 self.onconnect = function(event) 13 self.onconnect = function(event)
14 { 14 {
15 self.postMessage = function(message) 15 self.postMessage = function(message)
16 { 16 {
17 event.ports[0].postMessage(message); 17 event.ports[0].postMessage(message);
18 }; 18 };
19 // Offload any stored messages now that someone has connected to us. 19 // Offload any stored messages now that someone has connected to us.
20 if (typeof self.pendingMessages === "undefined") 20 if (typeof self.pendingMessages === "undefined")
21 return; 21 return;
22 while (self.pendingMessages.length) 22 while (self.pendingMessages.length)
23 event.ports[0].postMessage(self.pendingMessages.shift()); 23 event.ports[0].postMessage(self.pendingMessages.shift());
24 }; 24 };
25 } 25 }
26 26
27 function removeVendorPrefixes()
28 {
29 indexedDB = evalAndLog("indexedDB = self.indexedDB || self.webkitIndexedDB | | self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;");
30 debug("");
31 }
32
33 function unexpectedSuccessCallback() 27 function unexpectedSuccessCallback()
34 { 28 {
35 testFailed("Success function called unexpectedly."); 29 testFailed("Success function called unexpectedly.");
36 finishJSTest(); 30 finishJSTest();
37 } 31 }
38 32
39 function unexpectedErrorCallback(event) 33 function unexpectedErrorCallback(event)
40 { 34 {
41 testFailed("Error function called unexpectedly: (" + event.target.error.name + ") " + event.target.error.message); 35 testFailed("Error function called unexpectedly: (" + event.target.error.name + ") " + event.target.error.message);
42 finishJSTest(); 36 finishJSTest();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ABORT_ERR: 20, 158 ABORT_ERR: 20,
165 URL_MISMATCH_ERR: 21, 159 URL_MISMATCH_ERR: 21,
166 QUOTA_EXCEEDED_ERR: 22, 160 QUOTA_EXCEEDED_ERR: 22,
167 TIMEOUT_ERR: 23, 161 TIMEOUT_ERR: 23,
168 INVALID_NODE_TYPE_ERR: 24, 162 INVALID_NODE_TYPE_ERR: 24,
169 DATA_CLONE_ERR: 25 163 DATA_CLONE_ERR: 25
170 }; 164 };
171 } 165 }
172 166
173 function indexedDBTest(upgradeCallback, optionalOpenCallback, optionalParameters ) { 167 function indexedDBTest(upgradeCallback, optionalOpenCallback, optionalParameters ) {
174 removeVendorPrefixes();
175 if (optionalParameters && 'suffix' in optionalParameters) { 168 if (optionalParameters && 'suffix' in optionalParameters) {
176 setDBNameFromPath(optionalParameters['suffix']); 169 setDBNameFromPath(optionalParameters['suffix']);
177 } else { 170 } else {
178 setDBNameFromPath(); 171 setDBNameFromPath();
179 } 172 }
180 var deleteRequest = evalAndLog("indexedDB.deleteDatabase(dbname)"); 173 var deleteRequest = evalAndLog("indexedDB.deleteDatabase(dbname)");
181 deleteRequest.onerror = unexpectedErrorCallback; 174 deleteRequest.onerror = unexpectedErrorCallback;
182 deleteRequest.onblocked = unexpectedBlockedCallback; 175 deleteRequest.onblocked = unexpectedBlockedCallback;
183 deleteRequest.onsuccess = function() { 176 deleteRequest.onsuccess = function() {
184 self.openRequest = null; 177 self.openRequest = null;
(...skipping 23 matching lines...) Expand all
208 201
209 requests.forEach(function(req) { 202 requests.forEach(function(req) {
210 req.onsuccess = function() { 203 req.onsuccess = function() {
211 --count; 204 --count;
212 if (!count) 205 if (!count)
213 callback(requests); 206 callback(requests);
214 }; 207 };
215 req.onerror = unexpectedErrorCallback; 208 req.onerror = unexpectedErrorCallback;
216 }); 209 });
217 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698