Index: chrome/test/data/extensions/api_test/media_galleries/read_access/test.js |
diff --git a/chrome/test/data/extensions/api_test/media_galleries/read_access/test.js b/chrome/test/data/extensions/api_test/media_galleries/read_access/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0d4321f05c38e508229513090e3964a006e2308c |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/media_galleries/read_access/test.js |
@@ -0,0 +1,30 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+var mediaGalleries = chrome.mediaGalleries; |
+ |
+var mediaFileSystemsDirectoryErrorCallback = function(err) { |
+ chrome.test.fail("Couldn't read from directory: " + err); |
+}; |
+ |
+var mediaFileSystemsListCallback = function(results) { |
+ // There should be a "Pictures" directory on all desktop platforms. |
+ var expectedFileSystems = 1; |
+ // But not on Android and ChromeOS. |
+ if (/Android/.test(navigator.userAgent) || /CrOS/.test(navigator.userAgent)) |
+ expectedFileSystems = 0; |
+ chrome.test.assertEq(expectedFileSystems, results.length); |
+ if (expectedFileSystems) { |
+ var dir_reader = results[0].root.createReader(); |
+ dir_reader.readEntries(chrome.test.callbackPass(), |
+ mediaFileSystemsDirectoryErrorCallback); |
+ } |
+}; |
+ |
+chrome.test.runTests([ |
+ function getGalleries() { |
+ mediaGalleries.getMediaFileSystems( |
+ chrome.test.callbackPass(mediaFileSystemsListCallback)); |
+ }, |
+]); |