Index: chrome/test/data/extensions/api_test/media_galleries/no_access/test.js |
diff --git a/chrome/test/data/extensions/api_test/media_galleries/no_access/test.js b/chrome/test/data/extensions/api_test/media_galleries/no_access/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3cc293c25e3c867df63e63b9ea82732b30f6e387 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/media_galleries/no_access/test.js |
@@ -0,0 +1,35 @@ |
+// 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 mediaFileSystemsDirectoryEntryCallback = function(entries) { |
+ chrome.test.fail("Shouldn't have been able to get a directory listing."); |
+}; |
+ |
+var mediaFileSystemsDirectoryErrorCallback = function(err) { |
+ // When this callback completes, success will be signalled. |
+}; |
+ |
+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( |
+ mediaFileSystemsDirectoryEntryCallback, |
+ chrome.test.callbackPass(mediaFileSystemsDirectoryErrorCallback)); |
Matt Perry
2012/07/26 19:46:47
I think you can omit the argument rather than pass
vandebo (ex-Chrome)
2012/07/26 23:25:19
Done.
|
+ } |
+}; |
+ |
+chrome.test.runTests([ |
+ function getGalleries() { |
+ mediaGalleries.getMediaFileSystems( |
+ chrome.test.callbackPass(mediaFileSystemsListCallback)); |
+ }, |
+]); |