Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // These have to be sync'd with file_browser_private_apitest.cc | 5 // These have to be sync'd with file_browser_private_apitest.cc |
| 6 var expectedVolume1 = { | 6 var expectedVolume1 = { |
| 7 devicePath: 'device_path1', | 7 devicePath: 'device_path1', |
| 8 mountPath: 'removable/mount_path1', | 8 mountPath: 'removable/mount_path1', |
| 9 systemPath: 'system_path1', | 9 systemPath: 'system_path1', |
| 10 filePath: 'file_path1', | 10 filePath: 'file_path1', |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 function createFileUrl(fileName) { | 122 function createFileUrl(fileName) { |
| 123 var testExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla"; | 123 var testExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla"; |
| 124 var fileUrl = "filesystem:chrome-extension://" + testExtensionId + | 124 var fileUrl = "filesystem:chrome-extension://" + testExtensionId + |
| 125 "/external/" + fileName; | 125 "/external/" + fileName; |
| 126 return fileUrl; | 126 return fileUrl; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 chrome.test.runTests([ | 129 chrome.test.runTests([ |
| 130 function removeMount() { | 130 function removeMount() { |
| 131 // The ID of this extension. | 131 // The ID of this extension. |
| 132 var fileUrl = createFileUrl("tmp/test_file.zip"); | 132 var fileUrl = createFileUrl("archive/archive_mount_path"); |
| 133 | 133 |
| 134 chrome.fileBrowserPrivate.removeMount(fileUrl); | 134 chrome.fileBrowserPrivate.removeMount(fileUrl); |
| 135 | 135 |
| 136 // We actually check this one on C++ side. If MountLibrary.RemoveMount | 136 // We actually check this one on C++ side. If MountLibrary.RemoveMount |
| 137 // doesn't get called, test will fail. | 137 // doesn't get called, test will fail. |
| 138 chrome.test.succeed(); | 138 chrome.test.succeed(); |
| 139 }, | 139 }, |
| 140 | 140 |
| 141 function removeMountNonExisting() { | |
|
tonibarzic
2012/04/25 18:39:09
This will probably fail now :)
hshi
2012/04/25 18:48:08
Yes I agree that this test no longer makes sense a
| |
| 142 // The ID of this extension. | |
| 143 var fileUrl = createFileUrl("archive/archive_mount_path_non_existing"); | |
| 144 | |
| 145 chrome.fileBrowserPrivate.removeMount(fileUrl); | |
| 146 | |
| 147 // We actually check this one on C++ side. The Url is a non-existing mount | |
| 148 // path, so we expect that MountLibrary.RemoveMount should not get called. | |
| 149 // If MountLibrary.RemoveMount does get called, test will fail because | |
| 150 // it expects MountLibrary.RemoveMount to be called only once in the | |
| 151 // preceeding test "removeMount". | |
| 152 chrome.test.succeed(); | |
| 153 }, | |
| 154 | |
| 141 function getVolumeMetadataValid1() { | 155 function getVolumeMetadataValid1() { |
| 142 chrome.fileBrowserPrivate.getVolumeMetadata( | 156 chrome.fileBrowserPrivate.getVolumeMetadata( |
| 143 createFileUrl(expectedVolume1.mountPath), | 157 createFileUrl(expectedVolume1.mountPath), |
| 144 chrome.test.callbackPass(function(result) { | 158 chrome.test.callbackPass(function(result) { |
| 145 chrome.test.assertTrue( | 159 chrome.test.assertTrue( |
| 146 validateObject(result, expectedVolume1, 'volume'), | 160 validateObject(result, expectedVolume1, 'volume'), |
| 147 "getVolumeMetadata result for first volume not as expected"); | 161 "getVolumeMetadata result for first volume not as expected"); |
| 148 })); | 162 })); |
| 149 }, | 163 }, |
| 150 | 164 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 'getMountPoints returned wrong number of mount points.'); | 212 'getMountPoints returned wrong number of mount points.'); |
| 199 for (var i = 0; i < expectedMountPoints.length; i++) { | 213 for (var i = 0; i < expectedMountPoints.length; i++) { |
| 200 chrome.test.assertTrue( | 214 chrome.test.assertTrue( |
| 201 validateObject(result[i], expectedMountPoints[i], 'mountPoint', | 215 validateObject(result[i], expectedMountPoints[i], 'mountPoint', |
| 202 treatMountPointException), | 216 treatMountPointException), |
| 203 'getMountPoints result[' + i +'] not as expected'); | 217 'getMountPoints result[' + i +'] not as expected'); |
| 204 } | 218 } |
| 205 })); | 219 })); |
| 206 } | 220 } |
| 207 ]); | 221 ]); |
| OLD | NEW |