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

Unified Diff: chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js

Issue 477583002: [fsp] Add a method to enumerate all mounted file systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 6 years, 4 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/file_system_provider/get_all/test.js
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js b/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..059ca6c99c3488eb3b8d6e70f1e82af78552a8b6
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js
@@ -0,0 +1,70 @@
+// Copyright 2014 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.
+
+'use strict';
+
+/**
+ * Runs all of the test cases, one by one.
+ */
+chrome.test.runTests([
+ // Verifies if getAll() returns the mounted file system.
+ function mountSuccess() {
+ var onTestSuccess = chrome.test.callbackPass();
+ chrome.fileSystemProvider.mount(
+ {
+ fileSystemId: test_util.FILE_SYSTEM_ID,
+ displayName: test_util.FILE_SYSTEM_NAME
+ },
+ function() {
+ chrome.fileSystemProvider.getAll(function(fileSystems) {
+ chrome.test.assertEq(1, fileSystems.length);
+ chrome.test.assertEq(
+ test_util.FILE_SYSTEM_ID, fileSystems[0].fileSystemId);
+ chrome.test.assertEq(
+ test_util.FILE_SYSTEM_NAME, fileSystems[0].displayName);
+ chrome.test.assertFalse(fileSystems[0].writable);
+ onTestSuccess();
+ });
+ },
+ function(error) {
+ chrome.test.fail(error.name);
+ });
+ },
+
+ // Verifies that after unmounting, the file system is not available in
+ // getAll() list.
+ function unmountSuccess() {
+ var onTestSuccess = chrome.test.callbackPass();
+ chrome.fileSystemProvider.unmount(
+ {fileSystemId: test_util.FILE_SYSTEM_ID},
+ function() {
+ chrome.fileSystemProvider.getAll(function(fileSystems) {
+ chrome.test.assertEq(0, fileSystems.length);
+ });
+ onTestSuccess();
+ },
+ function(error) {
+ chrome.test.fail(error.name);
+ });
+ },
+
+ // Verifies that if mounting fails, then the file system is not added to the
+ // getAll() list.
+ function mountError() {
+ var onTestSuccess = chrome.test.callbackPass();
+ chrome.fileSystemProvider.mount(
+ {fileSystemId: '', displayName: ''},
+ function() {
+ chrome.test.fail();
+ },
+ function(error) {
+ chrome.test.assertEq('SecurityError', error.name);
+ chrome.fileSystemProvider.getAll(function(fileSystems) {
+ chrome.test.assertEq(0, fileSystems.length);
+ });
+ onTestSuccess();
+ }
+ );
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698