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

Side by Side Diff: ui/file_manager/file_manager/background/js/volume_manager_unittest.js

Issue 1215533003: Add a refresh button for providers which do not support watchers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests. Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var chrome; 5 var chrome;
6 6
7 loadTimeData.data = { 7 loadTimeData.data = {
8 DRIVE_DIRECTORY_LABEL: 'My Drive', 8 DRIVE_DIRECTORY_LABEL: 'My Drive',
9 DOWNLOADS_DIRECTORY_LABEL: 'Downloads' 9 DOWNLOADS_DIRECTORY_LABEL: 'Downloads'
10 }; 10 };
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 chrome.fileManagerPrivate.driveConnectionState_ = 86 chrome.fileManagerPrivate.driveConnectionState_ =
87 VolumeManagerCommon.DriveConnectionType.ONLINE; 87 VolumeManagerCommon.DriveConnectionType.ONLINE;
88 chrome.fileManagerPrivate.volumeMetadataList_ = [ 88 chrome.fileManagerPrivate.volumeMetadataList_ = [
89 { 89 {
90 volumeId: 'download:Downloads', 90 volumeId: 'download:Downloads',
91 volumeLabel: '', 91 volumeLabel: '',
92 volumeType: VolumeManagerCommon.VolumeType.DOWNLOADS, 92 volumeType: VolumeManagerCommon.VolumeType.DOWNLOADS,
93 isReadOnly: false, 93 isReadOnly: false,
94 profile: getMockProfile(), 94 profile: getMockProfile(),
95 configurable: false, 95 configurable: false,
96 watchable: true,
96 source: VolumeManagerCommon.Source.SYSTEM 97 source: VolumeManagerCommon.Source.SYSTEM
97 }, 98 },
98 { 99 {
99 volumeId: 'drive:drive-foobar%40chromium.org-hash', 100 volumeId: 'drive:drive-foobar%40chromium.org-hash',
100 volumeLabel: '', 101 volumeLabel: '',
101 volumeType: VolumeManagerCommon.VolumeType.DRIVE, 102 volumeType: VolumeManagerCommon.VolumeType.DRIVE,
102 isReadOnly: false, 103 isReadOnly: false,
103 profile: getMockProfile(), 104 profile: getMockProfile(),
104 configurable: false, 105 configurable: false,
106 watchable: true,
105 source: VolumeManagerCommon.Source.NETWORK 107 source: VolumeManagerCommon.Source.NETWORK
106 } 108 }
107 ]; 109 ];
108 chrome.fileManagerPrivate.fileSystemMap_ = { 110 chrome.fileManagerPrivate.fileSystemMap_ = {
109 'download:Downloads': new MockFileSystem('download:Downloads'), 111 'download:Downloads': new MockFileSystem('download:Downloads'),
110 'drive:drive-foobar%40chromium.org-hash': 112 'drive:drive-foobar%40chromium.org-hash':
111 new MockFileSystem('drive:drive-foobar%40chromium.org-hash') 113 new MockFileSystem('drive:drive-foobar%40chromium.org-hash')
112 }; 114 };
113 } 115 }
114 116
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 eventType: 'mount', 186 eventType: 'mount',
185 status: 'success', 187 status: 'success',
186 volumeMetadata: { 188 volumeMetadata: {
187 volumeId: 'archive:foobar.zip', 189 volumeId: 'archive:foobar.zip',
188 volumeLabel: 'foobar.zip', 190 volumeLabel: 'foobar.zip',
189 volumeType: VolumeManagerCommon.VolumeType.ARCHIVE, 191 volumeType: VolumeManagerCommon.VolumeType.ARCHIVE,
190 isReadOnly: true, 192 isReadOnly: true,
191 sourcePath: mountSourcePath, 193 sourcePath: mountSourcePath,
192 profile: getMockProfile(), 194 profile: getMockProfile(),
193 configurable: false, 195 configurable: false,
196 watchable: true,
194 source: VolumeManagerCommon.Source.FILE 197 source: VolumeManagerCommon.Source.FILE
195 } 198 }
196 }); 199 });
197 }).then(function(result) { 200 }).then(function(result) {
198 assertEquals(numberOfVolumes + 1, volumeManager.volumeInfoList.length); 201 assertEquals(numberOfVolumes + 1, volumeManager.volumeInfoList.length);
199 202
200 return new Promise(function(resolve, reject) { 203 return new Promise(function(resolve, reject) {
201 // Unmount the mounted archievea 204 // Unmount the mounted archievea
202 volumeManager.volumeInfoList.addEventListener('splice', function(e) { 205 volumeManager.volumeInfoList.addEventListener('splice', function(e) {
203 assertEquals(numberOfVolumes, volumeManager.volumeInfoList.length); 206 assertEquals(numberOfVolumes, volumeManager.volumeInfoList.length);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 /* fileSystem */ null, 258 /* fileSystem */ null,
256 /* error */ null, 259 /* error */ null,
257 /* deviceType */ null, 260 /* deviceType */ null,
258 /* devicePath */ null, 261 /* devicePath */ null,
259 /* isReadOnly */ false, 262 /* isReadOnly */ false,
260 /* profile */ {}, 263 /* profile */ {},
261 /* label */ null, 264 /* label */ null,
262 /* extensionid */ null, 265 /* extensionid */ null,
263 /* hasMedia */ false, 266 /* hasMedia */ false,
264 /* configurable */ false, 267 /* configurable */ false,
268 /* watchable */ true,
265 /* source */ VolumeManagerCommon.Source.FILE); 269 /* source */ VolumeManagerCommon.Source.FILE);
266 list.add(volumeInfo); 270 list.add(volumeInfo);
267 var promiseAfterAdd = list.whenVolumeInfoReady('volumeId'); 271 var promiseAfterAdd = list.whenVolumeInfoReady('volumeId');
268 reportPromise(Promise.all([promiseBeforeAdd, promiseAfterAdd]).then( 272 reportPromise(Promise.all([promiseBeforeAdd, promiseAfterAdd]).then(
269 function(volumes) { 273 function(volumes) {
270 assertEquals(volumeInfo, volumes[0]); 274 assertEquals(volumeInfo, volumes[0]);
271 assertEquals(volumeInfo, volumes[1]); 275 assertEquals(volumeInfo, volumes[1]);
272 }), callback); 276 }), callback);
273 } 277 }
274 278
(...skipping 19 matching lines...) Expand all
294 }); 298 });
295 299
296 // Complete initialization. 300 // Complete initialization.
297 sendMetadataListCallback([]); 301 sendMetadataListCallback([]);
298 302
299 reportPromise(instancePromise.then(function(volumeManager) { 303 reportPromise(instancePromise.then(function(volumeManager) {
300 assertTrue(!!volumeManager.getCurrentProfileVolumeInfo( 304 assertTrue(!!volumeManager.getCurrentProfileVolumeInfo(
301 VolumeManagerCommon.VolumeType.DRIVE)); 305 VolumeManagerCommon.VolumeType.DRIVE));
302 }), callback); 306 }), callback);
303 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698