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 var expectedGalleryEntryLength; | 6 var expectedGalleryEntryLength; |
7 | 7 |
8 function TestFirstFilesystem(verifyFilesystem) { | 8 function TestFirstFilesystem(verifyFilesystem) { |
9 function getMediaFileSystemsList() { | 9 function getMediaFileSystemsList() { |
10 mediaGalleries.getMediaFileSystems(getMediaFileSystemsCallback); | 10 mediaGalleries.getMediaFileSystems(getMediaFileSystemsCallback); |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 function ReadFileToBytesTest() { | 36 function ReadFileToBytesTest() { |
37 function verifyFilesystem(filesystem) { | 37 function verifyFilesystem(filesystem) { |
38 verifyJPEG(filesystem.root, "test.jpg", expectedGalleryEntryLength, | 38 verifyJPEG(filesystem.root, "test.jpg", expectedGalleryEntryLength, |
39 chrome.test.succeed); | 39 chrome.test.succeed); |
40 } | 40 } |
41 | 41 |
42 TestFirstFilesystem(verifyFilesystem); | 42 TestFirstFilesystem(verifyFilesystem); |
43 } | 43 } |
44 | 44 |
| 45 function GetMetadataTest() { |
| 46 function verifyFilesystem(filesystem) { |
| 47 filesystem.root.getFile("test.jpg", {create: false}, verifyFileEntry, |
| 48 chrome.test.fail); |
| 49 } |
| 50 |
| 51 function verifyFileEntry(fileEntry) { |
| 52 fileEntry.file(verifyFile, chrome.test.fail) |
| 53 } |
| 54 |
| 55 function verifyFile(file) { |
| 56 mediaGalleries.getMetadata(file, {}, verifyMetadata); |
| 57 } |
| 58 |
| 59 function verifyMetadata(metadata) { |
| 60 chrome.test.assertEq("image/jpeg", metadata.mimeType); |
| 61 chrome.test.succeed(); |
| 62 } |
| 63 |
| 64 TestFirstFilesystem(verifyFilesystem); |
| 65 } |
| 66 |
45 function GetMediaFileSystemMetadataTest() { | 67 function GetMediaFileSystemMetadataTest() { |
46 function verifyFilesystem(filesystem) { | 68 function verifyFilesystem(filesystem) { |
47 var metadata = mediaGalleries.getMediaFileSystemMetadata(filesystem); | 69 var metadata = mediaGalleries.getMediaFileSystemMetadata(filesystem); |
48 checkMetadata(metadata); | 70 checkMetadata(metadata); |
49 chrome.test.succeed(); | 71 chrome.test.succeed(); |
50 } | 72 } |
51 | 73 |
52 TestFirstFilesystem(verifyFilesystem); | 74 TestFirstFilesystem(verifyFilesystem); |
53 } | 75 } |
54 | 76 |
55 CreateDummyWindowToPreventSleep(); | 77 CreateDummyWindowToPreventSleep(); |
56 | 78 |
57 chrome.test.getConfig(function(config) { | 79 chrome.test.getConfig(function(config) { |
58 customArg = JSON.parse(config.customArg); | 80 customArg = JSON.parse(config.customArg); |
59 expectedGalleryEntryLength = customArg[0]; | 81 expectedGalleryEntryLength = customArg[0]; |
60 | 82 |
61 chrome.test.runTests([ | 83 chrome.test.runTests([ |
62 ReadDirectoryTest, | 84 ReadDirectoryTest, |
63 ReadFileToBytesTest, | 85 ReadFileToBytesTest, |
| 86 GetMetadataTest, |
64 GetMediaFileSystemMetadataTest, | 87 GetMediaFileSystemMetadataTest, |
65 ]); | 88 ]); |
66 }) | 89 }) |
OLD | NEW |