Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: chrome/test/data/extensions/api_test/media_galleries/read_access/test.js

Issue 10822002: Media Galleries API: hookup the AllGalleries permission and add tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ },
+]);

Powered by Google App Engine
This is Rietveld 408576698