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

Side by Side Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js

Issue 15919006: Files.app: Test local delete and directory delete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 /** 5 /**
6 * Expected files before tests are performed. Entries for Local tests. 6 * Expected files before tests are performed. Entries for Local tests.
7 * @type {Array.<Array.<string>>} 7 * @type {Array.<Array.<string>>}
8 * @const 8 * @const
9 */ 9 */
10 var EXPECTED_FILES_BEFORE_LOCAL = [ 10 var EXPECTED_FILES_BEFORE_LOCAL = [
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Returns true if |fileList| contains |filename|. 309 // Returns true if |fileList| contains |filename|.
310 var isFilePresent = function(filename, fileList) { 310 var isFilePresent = function(filename, fileList) {
311 for (var i = 0; i < fileList.length; i++) { 311 for (var i = 0; i < fileList.length; i++) {
312 if (getFileName(fileList[i]) == filename) 312 if (getFileName(fileList[i]) == filename)
313 return true; 313 return true;
314 } 314 }
315 return false; 315 return false;
316 } 316 }
317 317
318 var filename = 'world.ogv'; 318 var filename = 'world.ogv';
319 var directoryName = 'photos';
319 var appId, fileListBefore; 320 var appId, fileListBefore;
320 var steps = [ 321 var steps = [
321 // Set up File Manager. 322 // Set up File Manager.
322 function() { 323 function() {
323 setupAndWaitUntilReady(path, steps.shift()); 324 setupAndWaitUntilReady(path, steps.shift());
324 }, 325 },
325 // Delete the file. 326 // Delete the file.
326 function(inAppId, inFileListBefore) { 327 function(inAppId, inFileListBefore) {
327 appId = inAppId; 328 appId = inAppId;
328 fileListBefore = inFileListBefore; 329 fileListBefore = inFileListBefore;
329 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); 330 chrome.test.assertTrue(isFilePresent(filename, fileListBefore));
330 callRemoteTestUtil('deleteFile', appId, [filename], steps.shift()); 331 callRemoteTestUtil('deleteFile', appId, [filename], steps.shift());
331 }, 332 },
332 // Reply to a dialog. 333 // Reply to a dialog.
333 function(result) { 334 function(result) {
334 chrome.test.assertTrue(result); 335 chrome.test.assertTrue(result);
335 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift()); 336 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift());
336 }, 337 },
337 // Wait for a file list change. 338 // Wait for a file list change.
338 function() { 339 function() {
339 callRemoteTestUtil('waitForFileListChange', appId, 340 callRemoteTestUtil('waitForFileListChange', appId,
340 [fileListBefore.length], steps.shift()); 341 [fileListBefore.length], steps.shift());
341 }, 342 },
343 // Delete the directory.
344 function(fileList) {
345 fileListBefore = fileList;
346 chrome.test.assertFalse(isFilePresent(filename, fileList));
347 chrome.test.assertTrue(isFilePresent(directoryName, fileList));
348 callRemoteTestUtil('deleteFile', appId, [directoryName], steps.shift());
349 },
350 // Reply to a dialog.
351 function(result) {
352 chrome.test.assertTrue(result);
353 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift());
354 },
355 // Wait for a file list change.
356 function() {
357 callRemoteTestUtil('waitForFileListChange', appId,
358 [fileListBefore.length], steps.shift());
359 },
342 // Verify the result. 360 // Verify the result.
343 function(fileList) { 361 function(fileList) {
344 chrome.test.assertFalse(isFilePresent(filename, fileList)); 362 chrome.test.assertFalse(isFilePresent(directoryName, fileList));
345 checkIfNoErrorsOccured(chrome.test.succeed); 363 checkIfNoErrorsOccured(chrome.test.succeed);
mtomasz 2013/05/28 11:07:17 This will not work. We have to wrap it with a call
hashimoto 2013/05/29 06:26:26 Done. Should we fix other tests doing the same thi
mtomasz 2013/05/29 06:40:11 I'm going to do it here: crbug.com/244327 today to
hashimoto 2013/05/29 06:53:16 Ah, I see.
346 } 364 }
347 ]; 365 ];
348 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); 366 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
349 steps.shift()(); 367 steps.shift()();
350 }; 368 };
351 369
352 testcase.fileDisplayDownloads = function() { 370 testcase.fileDisplayDownloads = function() {
353 testcase.intermediate.fileDisplay('/Downloads'); 371 testcase.intermediate.fileDisplay('/Downloads');
354 }; 372 };
355 373
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 /** 685 /**
668 * Tests copy from drive's offline to drive's root. 686 * Tests copy from drive's offline to drive's root.
669 */ 687 */
670 testcase.transferFromOfflineToDrive = function() { 688 testcase.transferFromOfflineToDrive = function() {
671 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', 689 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc',
672 'drive_offline', 690 'drive_offline',
673 EXPECTED_FILES_IN_OFFLINE, 691 EXPECTED_FILES_IN_OFFLINE,
674 'drive', 692 'drive',
675 EXPECTED_FILES_BEFORE_DRIVE); 693 EXPECTED_FILES_BEFORE_DRIVE);
676 }; 694 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698