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 volumeId: 'removable:mount_path1', | 7 volumeId: 'removable:mount_path1', |
8 mountPath: '/removable/mount_path1', | 8 mountPath: '/removable/mount_path1', |
9 sourcePath: 'device_path1', | 9 sourcePath: 'device_path1', |
10 volumeType: 'removable', | 10 volumeType: 'removable', |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 volumeId: 'archive:archive_mount_path', | 63 volumeId: 'archive:archive_mount_path', |
64 mountPath: '/archive/archive_mount_path', | 64 mountPath: '/archive/archive_mount_path', |
65 sourcePath: 'archive_path', | 65 sourcePath: 'archive_path', |
66 volumeType: 'archive', | 66 volumeType: 'archive', |
67 isReadOnly: true, | 67 isReadOnly: true, |
68 profile: {profileId: "", displayName: "", isCurrentProfile: true} | 68 profile: {profileId: "", displayName: "", isCurrentProfile: true} |
69 }; | 69 }; |
70 | 70 |
71 // List of expected mount points. | 71 // List of expected mount points. |
72 // NOTE: this has to be synced with values in file_browser_private_apitest.cc | 72 // NOTE: this has to be synced with values in file_browser_private_apitest.cc |
73 // and values sorted by mountPath. | 73 // and values sorted by volumeId. |
74 var expectedVolumeList = [ | 74 var expectedVolumeList = [ |
| 75 expectedArchiveVolume, |
| 76 expectedDownloadsVolume, |
75 expectedDriveVolume, | 77 expectedDriveVolume, |
76 expectedDownloadsVolume, | |
77 expectedArchiveVolume, | |
78 expectedVolume1, | 78 expectedVolume1, |
79 expectedVolume2, | 79 expectedVolume2, |
80 expectedVolume3, | 80 expectedVolume3, |
81 ]; | 81 ]; |
82 | 82 |
83 function validateObject(received, expected, name) { | 83 function validateObject(received, expected, name) { |
84 for (var key in expected) { | 84 for (var key in expected) { |
85 if (expected[key] instanceof RegExp) { | 85 if (expected[key] instanceof RegExp) { |
86 if (!expected[key].test(received[key])) { | 86 if (!expected[key].test(received[key])) { |
87 console.warn('Expected "' + key + '" ' + name + ' property to match: ' + | 87 console.warn('Expected "' + key + '" ' + name + ' property to match: ' + |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 chrome.fileBrowserPrivate.removeMount('archive:archive_mount_path'); | 119 chrome.fileBrowserPrivate.removeMount('archive:archive_mount_path'); |
120 | 120 |
121 // We actually check this one on C++ side. If MountLibrary.RemoveMount | 121 // We actually check this one on C++ side. If MountLibrary.RemoveMount |
122 // doesn't get called, test will fail. | 122 // doesn't get called, test will fail. |
123 chrome.test.succeed(); | 123 chrome.test.succeed(); |
124 }, | 124 }, |
125 | 125 |
126 function getVolumeMetadataList() { | 126 function getVolumeMetadataList() { |
127 chrome.fileBrowserPrivate.getVolumeMetadataList( | 127 chrome.fileBrowserPrivate.getVolumeMetadataList( |
128 chrome.test.callbackPass(function(result) { | 128 chrome.test.callbackPass(function(result) { |
129 chrome.test.assertEq(result.length, expectedVolumeList.length, | 129 chrome.test.assertEq(expectedVolumeList.length, result.length, |
130 'getMountPoints returned wrong number of mount points.'); | 130 'getMountPoints returned wrong number of mount points.'); |
131 for (var i = 0; i < expectedVolumeList.length; i++) { | 131 for (var i = 0; i < expectedVolumeList.length; i++) { |
132 chrome.test.assertTrue( | 132 chrome.test.assertTrue( |
133 validateObject( | 133 validateObject( |
134 result[i], expectedVolumeList[i], 'volumeMetadata'), | 134 result[i], expectedVolumeList[i], 'volumeMetadata'), |
135 'getMountPoints result[' + i + '] not as expected'); | 135 'getMountPoints result[' + i + '] not as expected'); |
136 } | 136 } |
137 })); | 137 })); |
138 } | 138 } |
139 ]); | 139 ]); |
OLD | NEW |