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

Side by Side Diff: chrome/test/data/extensions/api_test/media_galleries/common/common_injected.js

Issue 254943002: Revert of Stop passing chrome.test.fail as ErrorCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Valid WEBP image. 5 // Valid WEBP image.
6 var validWEBPImageCase = { 6 var validWEBPImageCase = {
7 filename: "valid.webp", 7 filename: "valid.webp",
8 blobString: "RIFF0\0\0\0WEBPVP8 $\0\0\0\xB2\x02\0\x9D\x01\x2A" + 8 blobString: "RIFF0\0\0\0WEBPVP8 $\0\0\0\xB2\x02\0\x9D\x01\x2A" +
9 "\x01\0\x01\0\x2F\x9D\xCE\xE7s\xA8((((\x01\x9CK(\0" + 9 "\x01\0\x01\0\x2F\x9D\xCE\xE7s\xA8((((\x01\x9CK(\0" +
10 "\x05\xCE\xB3l\0\0\xFE\xD8\x80\0\0" 10 "\x05\xCE\xB3l\0\0\xFE\xD8\x80\0\0"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 allEntries = allEntries.concat(entries); 195 allEntries = allEntries.concat(entries);
196 readEntries(); 196 readEntries();
197 } 197 }
198 198
199 readEntries(); 199 readEntries();
200 } 200 }
201 201
202 function verifyJPEG(parentDirectoryEntry, filename, expectedFileLength, 202 function verifyJPEG(parentDirectoryEntry, filename, expectedFileLength,
203 doneCallback) { 203 doneCallback) {
204 function verifyFileEntry(fileEntry) { 204 function verifyFileEntry(fileEntry) {
205 fileEntry.file(verifyFile, chrome.test.fail); 205 fileEntry.file(verifyFile, chrome.test.fail)
206 } 206 }
207 207
208 function verifyFile(file) { 208 function verifyFile(file) {
209 var reader = new FileReader(); 209 var reader = new FileReader();
210 210
211 reader.onload = function(e) { 211 reader.onload = function(e) {
212 var arraybuffer = e.target.result; 212 var arraybuffer = e.target.result;
213 chrome.test.assertEq(expectedFileLength, arraybuffer.byteLength); 213 chrome.test.assertEq(expectedFileLength, arraybuffer.byteLength);
214 doneCallback(); 214 doneCallback();
215 }; 215 }
216 216
217 reader.onerror = function(e) { 217 reader.onerror =
218 chrome.test.fail("Unable to read test image: " + filename); 218 chrome.test.fail.bind(null, "Unable to read test image: " + filename);
219 };
220 219
221 reader.readAsArrayBuffer(file); 220 reader.readAsArrayBuffer(file);
222 } 221 }
223 222
224 parentDirectoryEntry.getFile(filename, {create: false}, verifyFileEntry, 223 parentDirectoryEntry.getFile(filename, {create: false}, verifyFileEntry,
225 chrome.test.fail); 224 chrome.test.fail);
226 } 225 }
227 226
228 // Create a dummy window to prevent the ProcessManager from suspending the 227 // Create a dummy window to prevent the ProcessManager from suspending the
229 // chrome-test app. Needed because the writer.onerror and writer.onwriteend 228 // chrome-test app. Needed because the writer.onerror and writer.onwriteend
230 // events do not qualify as pending callbacks, so the app looks dormant. 229 // events do not qualify as pending callbacks, so the app looks dormant.
231 function CreateDummyWindowToPreventSleep() { 230 function CreateDummyWindowToPreventSleep() {
232 chrome.app.runtime.onLaunched.addListener(function() { 231 chrome.app.runtime.onLaunched.addListener(function() {
233 chrome.app.window.create('dummy.html', { 232 chrome.app.window.create('dummy.html', {
234 outerBounds: { 233 outerBounds: {
235 width: 800, 234 width: 800,
236 height: 600, 235 height: 600,
237 left: 100, 236 left: 100,
238 top: 100, 237 top: 100,
239 minWidth: 800, 238 minWidth: 800,
240 minHeight: 600 239 minHeight: 600
241 } 240 }
242 }); 241 });
243 }); 242 });
244 } 243 }
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698