| 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 |
| 41 chrome.test.getConfig(function(config) { | 43 chrome.test.getConfig(function(config) { |
| 42 customArg = JSON.parse(config.customArg); | 44 customArg = JSON.parse(config.customArg); |
| 43 expectedFileSystems = customArg[0]; | 45 expectedFileSystems = customArg[0]; |
| 44 | 46 |
| 45 chrome.test.runTests([ | 47 chrome.test.runTests([ |
| 46 function getMediaFileSystems() { | 48 function getMediaFileSystems() { |
| 47 mediaGalleries.getMediaFileSystems( | 49 mediaGalleries.getMediaFileSystems( |
| 48 chrome.test.callbackPass(mediaFileSystemsListCallback)); | 50 chrome.test.callbackPass(mediaFileSystemsListCallback)); |
| 49 }, | 51 }, |
| 50 function testGalleries() { | 52 function testGalleries() { |
| 51 chrome.test.assertEq(expectedFileSystems, galleries.length); | 53 chrome.test.assertEq(expectedFileSystems, galleries.length); |
| 52 if (expectedFileSystems == 0) { | |
| 53 chrome.test.succeed(); | |
| 54 return; | |
| 55 } | |
| 56 | |
| 57 for (var i = 0; i < galleries.length; i++) { | 54 for (var i = 0; i < galleries.length; i++) { |
| 58 var dirReader = galleries[i].root.createReader(); | 55 var dirReader = galleries[i].root.createReader(); |
| 59 dirReader.readEntries(mediaFileSystemsDirectoryEntryCallback, | 56 dirReader.readEntries(mediaFileSystemsDirectoryEntryCallback, |
| 60 mediaFileSystemsDirectoryErrorCallback); | 57 mediaFileSystemsDirectoryErrorCallback); |
| 61 } | 58 } |
| 62 }, | 59 }, |
| 63 | 60 function validFileCopyToShouldFail() { |
| 61 runCopyToTest(validWEBPImageCase, false /* expect failure */); |
| 62 }, |
| 63 function invalidFileCopyToShouldFail() { |
| 64 runCopyToTest(invalidWEBPImageCase, false /* expect failure */); |
| 65 }, |
| 64 ]); | 66 ]); |
| 65 }) | 67 }) |
| OLD | NEW |