OLD | NEW |
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 * |
(...skipping 23 matching lines...) Expand all Loading... |
34 chrome.test.callbackPass(function(extensions) { | 34 chrome.test.callbackPass(function(extensions) { |
35 chrome.test.assertEq(extensions.length, 1); | 35 chrome.test.assertEq(extensions.length, 1); |
36 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); | 36 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); |
37 chrome.test.assertEq( | 37 chrome.test.assertEq( |
38 chrome.runtime.getManifest().name, extensions[0].name); | 38 chrome.runtime.getManifest().name, extensions[0].name); |
39 chrome.test.assertTrue(extensions[0].configurable); | 39 chrome.test.assertTrue(extensions[0].configurable); |
40 chrome.test.assertFalse(extensions[0].multipleMounts); | 40 chrome.test.assertFalse(extensions[0].multipleMounts); |
41 chrome.test.assertEq('device', extensions[0].source); | 41 chrome.test.assertEq('device', extensions[0].source); |
42 })); | 42 })); |
43 | 43 |
44 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, | 44 chrome.fileManagerPrivate.configureVolume(test_util.volumeId, |
45 chrome.test.callbackPass(function() {})); | 45 chrome.test.callbackPass(function() {})); |
46 }, | 46 }, |
47 | 47 |
48 // Verify that chrome.fileManager.configureProvidedFileSystem is well wired | 48 // Verify that chrome.fileManager.configureVolume is well wired |
49 // to onConfigureRequested(). | 49 // to onConfigureRequested(). |
50 function configureSuccess() { | 50 function configureSuccess() { |
51 var configured = false; | 51 var configured = false; |
52 var onConfigureRequested = chrome.test.callbackPass( | 52 var onConfigureRequested = chrome.test.callbackPass( |
53 function(options, onSuccess, onError) { | 53 function(options, onSuccess, onError) { |
54 chrome.fileSystemProvider.onConfigureRequested.removeListener( | 54 chrome.fileSystemProvider.onConfigureRequested.removeListener( |
55 onConfigureRequested); | 55 onConfigureRequested); |
56 configured = true; | 56 configured = true; |
57 onSuccess(); | 57 onSuccess(); |
58 }); | 58 }); |
59 chrome.fileSystemProvider.onConfigureRequested.addListener( | 59 chrome.fileSystemProvider.onConfigureRequested.addListener( |
60 onConfigureRequested); | 60 onConfigureRequested); |
61 | 61 |
62 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, | 62 chrome.fileManagerPrivate.configureVolume(test_util.volumeId, |
63 chrome.test.callbackPass(function() { | 63 chrome.test.callbackPass(function() { |
64 chrome.test.assertTrue(configured); | 64 chrome.test.assertTrue(configured); |
65 })); | 65 })); |
66 }, | 66 }, |
67 | 67 |
68 // Verify that a failure is propagated properly. | 68 // Verify that a failure is propagated properly. |
69 function configureFailure() { | 69 function configureFailure() { |
70 var onConfigureRequested = chrome.test.callbackPass( | 70 var onConfigureRequested = chrome.test.callbackPass( |
71 function(options, onSuccess, onError) { | 71 function(options, onSuccess, onError) { |
72 chrome.fileSystemProvider.onConfigureRequested.removeListener( | 72 chrome.fileSystemProvider.onConfigureRequested.removeListener( |
73 onConfigureRequested); | 73 onConfigureRequested); |
74 onError('FAILED'); | 74 onError('FAILED'); |
75 }); | 75 }); |
76 | 76 |
77 chrome.fileSystemProvider.onConfigureRequested.addListener( | 77 chrome.fileSystemProvider.onConfigureRequested.addListener( |
78 onConfigureRequested); | 78 onConfigureRequested); |
79 | 79 |
80 chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, | 80 chrome.fileManagerPrivate.configureVolume(test_util.volumeId, |
81 chrome.test.callbackFail('Failed to complete configuration.')); | 81 chrome.test.callbackFail('Failed to complete configuration.')); |
82 }, | 82 }, |
83 | 83 |
84 ]); | 84 ]); |
85 } | 85 } |
86 | 86 |
87 // Setup and run all of the test cases. | 87 // Setup and run all of the test cases. |
88 setUp(runTests); | 88 setUp(runTests); |
OLD | NEW |