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

Side by Side Diff: chrome/test/data/extensions/api_test/file_browser/mount_test/test.js

Issue 1137383002: Show the eject button only for removabled and file handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified. 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 (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_manager_private_apitest.cc 5 // These have to be sync'd with file_manager_private_apitest.cc
6 var expectedVolume1 = { 6 var expectedVolume1 = {
7 volumeId: 'removable:mount_path1', 7 volumeId: 'removable:mount_path1',
8 volumeLabel: 'mount_path1', 8 volumeLabel: 'mount_path1',
9 sourcePath: 'device_path1', 9 sourcePath: 'device_path1',
10 volumeType: 'removable', 10 volumeType: 'removable',
11 deviceType: 'usb', 11 deviceType: 'usb',
12 devicePath: 'system_path_prefix1', 12 devicePath: 'system_path_prefix1',
13 isParentDevice: false, 13 isParentDevice: false,
14 isReadOnly: false, 14 isReadOnly: false,
15 hasMedia: false, 15 hasMedia: false,
16 profile: {profileId: "", displayName: "", isCurrentProfile: true} 16 configurable: false,
17 source: 'device',
18 profile: {profileId: "", displayName: "", isCurrentProfile: true},
17 }; 19 };
18 20
19 var expectedVolume2 = { 21 var expectedVolume2 = {
20 volumeId: 'removable:mount_path2', 22 volumeId: 'removable:mount_path2',
21 volumeLabel: 'mount_path2', 23 volumeLabel: 'mount_path2',
22 sourcePath: 'device_path2', 24 sourcePath: 'device_path2',
23 volumeType: 'removable', 25 volumeType: 'removable',
24 deviceType: 'mobile', 26 deviceType: 'mobile',
25 devicePath: 'system_path_prefix2', 27 devicePath: 'system_path_prefix2',
26 isParentDevice: true, 28 isParentDevice: true,
27 isReadOnly: true, 29 isReadOnly: true,
28 hasMedia: true, 30 hasMedia: true,
31 configurable: false,
32 source: 'device',
29 profile: {profileId: "", displayName: "", isCurrentProfile: true} 33 profile: {profileId: "", displayName: "", isCurrentProfile: true}
30 }; 34 };
31 35
32 var expectedVolume3 = { 36 var expectedVolume3 = {
33 volumeId: 'removable:mount_path3', 37 volumeId: 'removable:mount_path3',
34 volumeLabel: 'mount_path3', 38 volumeLabel: 'mount_path3',
35 sourcePath: 'device_path3', 39 sourcePath: 'device_path3',
36 volumeType: 'removable', 40 volumeType: 'removable',
37 deviceType: 'optical', 41 deviceType: 'optical',
38 devicePath: 'system_path_prefix3', 42 devicePath: 'system_path_prefix3',
39 isParentDevice: true, 43 isParentDevice: true,
40 isReadOnly: false, 44 isReadOnly: false,
41 hasMedia: false, 45 hasMedia: false,
46 configurable: false,
47 source: 'device',
42 profile: {profileId: "", displayName: "", isCurrentProfile: true} 48 profile: {profileId: "", displayName: "", isCurrentProfile: true}
43 }; 49 };
44 50
45 var expectedDownloadsVolume = { 51 var expectedDownloadsVolume = {
46 volumeId: /^downloads:Downloads[^\/]*$/, 52 volumeId: /^downloads:Downloads[^\/]*$/,
47 volumeLabel: '', 53 volumeLabel: '',
48 volumeType: 'downloads', 54 volumeType: 'downloads',
49 isReadOnly: false, 55 isReadOnly: false,
50 hasMedia: false, 56 hasMedia: false,
57 configurable: false,
58 source: 'system',
51 profile: {profileId: "", displayName: "", isCurrentProfile: true} 59 profile: {profileId: "", displayName: "", isCurrentProfile: true}
52 }; 60 };
53 61
54 var expectedDriveVolume = { 62 var expectedDriveVolume = {
55 volumeId: /^drive:drive[^\/]*$/, 63 volumeId: /^drive:drive[^\/]*$/,
56 volumeLabel: '', 64 volumeLabel: '',
57 sourcePath: /^\/special\/drive[^\/]*$/, 65 sourcePath: /^\/special\/drive[^\/]*$/,
58 volumeType: 'drive', 66 volumeType: 'drive',
59 isReadOnly: false, 67 isReadOnly: false,
60 hasMedia: false, 68 hasMedia: false,
69 configurable: false,
70 source: 'network',
61 profile: {profileId: "", displayName: "", isCurrentProfile: true} 71 profile: {profileId: "", displayName: "", isCurrentProfile: true}
62 }; 72 };
63 73
64 var expectedArchiveVolume = { 74 var expectedArchiveVolume = {
65 volumeId: 'archive:archive_mount_path', 75 volumeId: 'archive:archive_mount_path',
66 volumeLabel: 'archive_mount_path', 76 volumeLabel: 'archive_mount_path',
67 sourcePath: /removable\/mount_path3\/archive.zip$/, 77 sourcePath: /removable\/mount_path3\/archive.zip$/,
68 volumeType: 'archive', 78 volumeType: 'archive',
69 isReadOnly: true, 79 isReadOnly: true,
70 hasMedia: false, 80 hasMedia: false,
81 configurable: false,
82 source: 'file',
71 profile: {profileId: "", displayName: "", isCurrentProfile: true} 83 profile: {profileId: "", displayName: "", isCurrentProfile: true}
72 }; 84 };
73 85
86 var expectedProvidedVolume = {
87 volumeId: 'provided:',
88 volumeLabel: '',
89 volumeType: 'provided',
90 isReadOnly: true,
91 hasMedia: false,
92 configurable: true,
93 extensionId: 'testing-extension-id',
94 source: 'network',
95 mountContext: 'auto',
96 fileSystemId: '',
97 profile: {profileId: "", displayName: "", isCurrentProfile: true}
hirono 2015/05/14 10:43:09 "" -> ''?
mtomasz 2015/05/15 02:03:38 Done.
98 };
99
74 // List of expected mount points. 100 // List of expected mount points.
75 // NOTE: this has to be synced with values in file_manager_private_apitest.cc 101 // NOTE: this has to be synced with values in file_manager_private_apitest.cc
76 // and values sorted by volumeId. 102 // and values sorted by volumeId.
77 var expectedVolumeList = [ 103 var expectedVolumeList = [
78 expectedArchiveVolume, 104 expectedArchiveVolume,
79 expectedDownloadsVolume, 105 expectedDownloadsVolume,
80 expectedDriveVolume, 106 expectedDriveVolume,
107 expectedProvidedVolume,
81 expectedVolume1, 108 expectedVolume1,
82 expectedVolume2, 109 expectedVolume2,
83 expectedVolume3, 110 expectedVolume3
84 ]; 111 ];
85 112
86 function validateObject(received, expected, name) { 113 function validateObject(received, expected, name) {
87 for (var key in expected) { 114 for (var key in expected) {
88 if (expected[key] instanceof RegExp) { 115 if (expected[key] instanceof RegExp) {
89 if (!expected[key].test(received[key])) { 116 if (!expected[key].test(received[key])) {
90 console.warn('Expected "' + key + '" ' + name + ' property to match: ' + 117 console.warn('Expected "' + key + '" ' + name + ' property to match: ' +
91 expected[key] + ', but got: "' + received[key] + '".'); 118 expected[key] + ', but got: "' + received[key] + '".');
92 return false; 119 return false;
93 } 120 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 'getMountPoints returned wrong number of mount points.'); 160 'getMountPoints returned wrong number of mount points.');
134 for (var i = 0; i < expectedVolumeList.length; i++) { 161 for (var i = 0; i < expectedVolumeList.length; i++) {
135 chrome.test.assertTrue( 162 chrome.test.assertTrue(
136 validateObject( 163 validateObject(
137 result[i], expectedVolumeList[i], 'volumeMetadata'), 164 result[i], expectedVolumeList[i], 'volumeMetadata'),
138 'getMountPoints result[' + i + '] not as expected'); 165 'getMountPoints result[' + i + '] not as expected');
139 } 166 }
140 })); 167 }));
141 } 168 }
142 ]); 169 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698