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

Side by Side Diff: chrome/test/data/extensions/api_test/file_system_provider/configure/test.js

Issue 1077823005: Declare providing extension capabilities in the manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Sets up the tests. Called once per all test cases. In case of a failure, 8 * Sets up the tests. Called once per all test cases. In case of a failure,
9 * the callback is not called. 9 * the callback is not called.
10 * 10 *
11 * @param {function()} callback Success callback. 11 * @param {function()} callback Success callback.
12 */ 12 */
13 function setUp(callback) { 13 function setUp(callback) {
14 test_util.mountFileSystem(callback); 14 test_util.mountFileSystem(callback);
15 } 15 }
16 16
17 /** 17 /**
18 * Runs all of the test cases, one by one. 18 * Runs all of the test cases, one by one.
19 */ 19 */
20 function runTests() { 20 function runTests() {
21 chrome.test.runTests([ 21 chrome.test.runTests([
22 // Verify that the configuration flag is propagated properly. 22 // Verify that the configuration flag is propagated properly.
23 function configureNotConfigurable() {
24 chrome.fileManagerPrivate.getProvidingExtensions(
25 chrome.test.callbackPass(function(extensions) {
26 chrome.test.assertEq(extensions.length, 1);
27 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId);
28 chrome.test.assertEq(
29 chrome.runtime.getManifest().name, extensions[0].name);
30 chrome.test.assertFalse(extensions[0].canConfigure);
31 chrome.test.assertFalse(extensions[0].canAdd);
32 }));
33
34 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId,
35 chrome.test.callbackFail('Failed to complete configuration.'));
36 },
37
38 // Verify that the configuration flag is propagated properly.
39 function configureConfigurable() { 23 function configureConfigurable() {
40 var onConfigureRequested = chrome.test.callbackPass( 24 var onConfigureRequested = chrome.test.callbackPass(
41 function(options, onSuccess, onError) { 25 function(options, onSuccess, onError) {
42 chrome.fileSystemProvider.onConfigureRequested.removeListener( 26 chrome.fileSystemProvider.onConfigureRequested.removeListener(
43 onConfigureRequested); 27 onConfigureRequested);
44 onSuccess(); 28 onSuccess();
45 }); 29 });
46 chrome.fileSystemProvider.onConfigureRequested.addListener( 30 chrome.fileSystemProvider.onConfigureRequested.addListener(
47 onConfigureRequested); 31 onConfigureRequested);
48 32
49 chrome.fileManagerPrivate.getProvidingExtensions( 33 chrome.fileManagerPrivate.getProvidingExtensions(
50 chrome.test.callbackPass(function(extensions) { 34 chrome.test.callbackPass(function(extensions) {
51 chrome.test.assertEq(extensions.length, 1); 35 chrome.test.assertEq(extensions.length, 1);
52 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); 36 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId);
53 chrome.test.assertEq( 37 chrome.test.assertEq(
54 chrome.runtime.getManifest().name, extensions[0].name); 38 chrome.runtime.getManifest().name, extensions[0].name);
55 chrome.test.assertTrue(extensions[0].canConfigure); 39 chrome.test.assertTrue(extensions[0].configurable);
56 chrome.test.assertFalse(extensions[0].canAdd); 40 chrome.test.assertFalse(extensions[0].multipleMounts);
41 chrome.test.assertEq('device', extensions[0].source);
57 })); 42 }));
58 43
59 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, 44 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId,
60 chrome.test.callbackPass(function() {})); 45 chrome.test.callbackPass(function() {}));
61 }, 46 },
62 47
63 // Verify that chrome.fileManager.configureProvidedFileSystem is well wired 48 // Verify that chrome.fileManager.configureProvidedFileSystem is well wired
64 // to onConfigureRequested(). 49 // to onConfigureRequested().
65 function configureSuccess() { 50 function configureSuccess() {
66 var configured = false; 51 var configured = false;
(...skipping 27 matching lines...) Expand all
94 79
95 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, 80 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId,
96 chrome.test.callbackFail('Failed to complete configuration.')); 81 chrome.test.callbackFail('Failed to complete configuration.'));
97 }, 82 },
98 83
99 ]); 84 ]);
100 } 85 }
101 86
102 // Setup and run all of the test cases. 87 // Setup and run all of the test cases.
103 setUp(runTests); 88 setUp(runTests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698