| OLD | NEW |
| 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 Loading... |
| 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 = | 217 reader.onerror = function(e) { |
| 218 chrome.test.fail.bind(null, "Unable to read test image: " + filename); | 218 chrome.test.fail("Unable to read test image: " + filename); |
| 219 }; |
| 219 | 220 |
| 220 reader.readAsArrayBuffer(file); | 221 reader.readAsArrayBuffer(file); |
| 221 } | 222 } |
| 222 | 223 |
| 223 parentDirectoryEntry.getFile(filename, {create: false}, verifyFileEntry, | 224 parentDirectoryEntry.getFile(filename, {create: false}, verifyFileEntry, |
| 224 chrome.test.fail); | 225 chrome.test.fail); |
| 225 } | 226 } |
| 226 | 227 |
| 227 // Create a dummy window to prevent the ProcessManager from suspending the | 228 // Create a dummy window to prevent the ProcessManager from suspending the |
| 228 // chrome-test app. Needed because the writer.onerror and writer.onwriteend | 229 // chrome-test app. Needed because the writer.onerror and writer.onwriteend |
| 229 // events do not qualify as pending callbacks, so the app looks dormant. | 230 // events do not qualify as pending callbacks, so the app looks dormant. |
| 230 function CreateDummyWindowToPreventSleep() { | 231 function CreateDummyWindowToPreventSleep() { |
| 231 chrome.app.runtime.onLaunched.addListener(function() { | 232 chrome.app.runtime.onLaunched.addListener(function() { |
| 232 chrome.app.window.create('dummy.html', { | 233 chrome.app.window.create('dummy.html', { |
| 233 outerBounds: { | 234 outerBounds: { |
| 234 width: 800, | 235 width: 800, |
| 235 height: 600, | 236 height: 600, |
| 236 left: 100, | 237 left: 100, |
| 237 top: 100, | 238 top: 100, |
| 238 minWidth: 800, | 239 minWidth: 800, |
| 239 minHeight: 600 | 240 minHeight: 600 |
| 240 } | 241 } |
| 241 }); | 242 }); |
| 242 }); | 243 }); |
| 243 } | 244 } |
| OLD | NEW |