OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var mediaGalleries = chrome.mediaGalleries; | 5 var mediaGalleries = chrome.mediaGalleries; |
6 | 6 |
7 var galleries; | 7 var galleries; |
8 var testResults = []; | 8 var testResults = []; |
9 var expectedFileSystems; | 9 var expectedFileSystems; |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 var mediaFileSystemsDirectoryErrorCallback = function(err) { | 32 var mediaFileSystemsDirectoryErrorCallback = function(err) { |
33 testResults.push(""); | 33 testResults.push(""); |
34 checkFinished(); | 34 checkFinished(); |
35 }; | 35 }; |
36 | 36 |
37 var mediaFileSystemsListCallback = function(results) { | 37 var mediaFileSystemsListCallback = function(results) { |
38 galleries = results; | 38 galleries = results; |
39 }; | 39 }; |
40 | 40 |
41 CreateDummyWindowToPreventSleep(); | |
42 | |
43 chrome.test.getConfig(function(config) { | 41 chrome.test.getConfig(function(config) { |
44 customArg = JSON.parse(config.customArg); | 42 customArg = JSON.parse(config.customArg); |
45 expectedFileSystems = customArg[0]; | 43 expectedFileSystems = customArg[0]; |
46 | 44 |
47 chrome.test.runTests([ | 45 chrome.test.runTests([ |
48 function getMediaFileSystems() { | 46 function getMediaFileSystems() { |
49 mediaGalleries.getMediaFileSystems( | 47 mediaGalleries.getMediaFileSystems( |
50 chrome.test.callbackPass(mediaFileSystemsListCallback)); | 48 chrome.test.callbackPass(mediaFileSystemsListCallback)); |
51 }, | 49 }, |
52 function testGalleries() { | 50 function testGalleries() { |
53 chrome.test.assertEq(expectedFileSystems, galleries.length); | 51 chrome.test.assertEq(expectedFileSystems, galleries.length); |
54 for (var i = 0; i < galleries.length; i++) { | 52 for (var i = 0; i < galleries.length; i++) { |
55 var dirReader = galleries[i].root.createReader(); | 53 var dirReader = galleries[i].root.createReader(); |
56 dirReader.readEntries(mediaFileSystemsDirectoryEntryCallback, | 54 dirReader.readEntries(mediaFileSystemsDirectoryEntryCallback, |
57 mediaFileSystemsDirectoryErrorCallback); | 55 mediaFileSystemsDirectoryErrorCallback); |
58 } | 56 } |
59 }, | 57 }, |
60 function validFileCopyToShouldFail() { | 58 function validFileCopyToShouldFail() { |
61 runCopyToTest(validWEBPImageCase, false /* expect failure */); | 59 runCopyToTest(validWEBPImageCase, false /* expect failure */); |
62 }, | 60 }, |
63 function invalidFileCopyToShouldFail() { | 61 function invalidFileCopyToShouldFail() { |
64 runCopyToTest(invalidWEBPImageCase, false /* expect failure */); | 62 runCopyToTest(invalidWEBPImageCase, false /* expect failure */); |
65 }, | 63 }, |
66 ]); | 64 ]); |
67 }) | 65 }) |
OLD | NEW |