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

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: Address comments 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
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 }, 362 },
363 // Wait for a file list change. 363 // Wait for a file list change.
364 function(result) { 364 function(result) {
365 chrome.test.assertTrue(result); 365 chrome.test.assertTrue(result);
366 callRemoteTestUtil('waitForFileListChange', appId, 366 callRemoteTestUtil('waitForFileListChange', appId,
367 [fileListBefore.length], steps.shift()); 367 [fileListBefore.length], steps.shift());
368 }, 368 },
369 // Verify the result. 369 // Verify the result.
370 function(fileList) { 370 function(fileList) {
371 chrome.test.assertTrue(isCopyPresent(filename, fileList)); 371 chrome.test.assertTrue(isCopyPresent(filename, fileList));
372 checkIfNoErrorsOccured(chrome.test.succeed); 372 checkIfNoErrorsOccured(steps.shift());
373 } 373 },
374 function() {}
374 ]; 375 ];
375 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); 376 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
376 steps.shift()(); 377 steps.shift()();
377 }; 378 };
378 379
379 /** 380 /**
380 * Tests deleting a file and and waits until the file lists changes. 381 * Tests deleting a file and and waits until the file lists changes.
381 * @param {string} path Directory path to be tested. 382 * @param {string} path Directory path to be tested.
382 */ 383 */
383 testcase.intermediate.keyboardDelete = function(path) { 384 testcase.intermediate.keyboardDelete = function(path) {
384 // Returns true if |fileList| contains |filename|. 385 // Returns true if |fileList| contains |filename|.
385 var isFilePresent = function(filename, fileList) { 386 var isFilePresent = function(filename, fileList) {
386 for (var i = 0; i < fileList.length; i++) { 387 for (var i = 0; i < fileList.length; i++) {
387 if (getFileName(fileList[i]) == filename) 388 if (getFileName(fileList[i]) == filename)
388 return true; 389 return true;
389 } 390 }
390 return false; 391 return false;
391 } 392 }
392 393
393 var filename = 'world.ogv'; 394 var filename = 'world.ogv';
395 var directoryName = 'photos';
394 var appId, fileListBefore; 396 var appId, fileListBefore;
395 var steps = [ 397 var steps = [
396 // Set up File Manager. 398 // Set up File Manager.
397 function() { 399 function() {
398 setupAndWaitUntilReady(path, steps.shift()); 400 setupAndWaitUntilReady(path, steps.shift());
399 }, 401 },
400 // Delete the file. 402 // Delete the file.
401 function(inAppId, inFileListBefore) { 403 function(inAppId, inFileListBefore) {
402 appId = inAppId; 404 appId = inAppId;
403 fileListBefore = inFileListBefore; 405 fileListBefore = inFileListBefore;
404 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); 406 chrome.test.assertTrue(isFilePresent(filename, fileListBefore));
405 callRemoteTestUtil('deleteFile', appId, [filename], steps.shift()); 407 callRemoteTestUtil('deleteFile', appId, [filename], steps.shift());
406 }, 408 },
407 // Reply to a dialog. 409 // Reply to a dialog.
408 function(result) { 410 function(result) {
409 chrome.test.assertTrue(result); 411 chrome.test.assertTrue(result);
410 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift()); 412 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift());
411 }, 413 },
412 // Wait for a file list change. 414 // Wait for a file list change.
413 function() { 415 function() {
414 callRemoteTestUtil('waitForFileListChange', appId, 416 callRemoteTestUtil('waitForFileListChange', appId,
415 [fileListBefore.length], steps.shift()); 417 [fileListBefore.length], steps.shift());
416 }, 418 },
419 // Delete the directory.
420 function(fileList) {
421 fileListBefore = fileList;
422 chrome.test.assertFalse(isFilePresent(filename, fileList));
423 chrome.test.assertTrue(isFilePresent(directoryName, fileList));
424 callRemoteTestUtil('deleteFile', appId, [directoryName], steps.shift());
425 },
426 // Reply to a dialog.
427 function(result) {
428 chrome.test.assertTrue(result);
429 callRemoteTestUtil('waitAndAcceptDialog', appId, [], steps.shift());
430 },
431 // Wait for a file list change.
432 function() {
433 callRemoteTestUtil('waitForFileListChange', appId,
434 [fileListBefore.length], steps.shift());
435 },
417 // Verify the result. 436 // Verify the result.
418 function(fileList) { 437 function(fileList) {
419 chrome.test.assertFalse(isFilePresent(filename, fileList)); 438 chrome.test.assertFalse(isFilePresent(directoryName, fileList));
420 checkIfNoErrorsOccured(chrome.test.succeed); 439 checkIfNoErrorsOccured(steps.shift());
421 } 440 },
441 function() {}
422 ]; 442 ];
423 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); 443 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
424 steps.shift()(); 444 steps.shift()();
425 }; 445 };
426 446
427 testcase.fileDisplayDownloads = function() { 447 testcase.fileDisplayDownloads = function() {
428 testcase.intermediate.fileDisplay('/Downloads'); 448 testcase.intermediate.fileDisplay('/Downloads');
429 }; 449 };
430 450
431 testcase.galleryOpenDownloads = function() { 451 testcase.galleryOpenDownloads = function() {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 /** 770 /**
751 * Tests copy from drive's offline to drive's root. 771 * Tests copy from drive's offline to drive's root.
752 */ 772 */
753 testcase.transferFromOfflineToDrive = function() { 773 testcase.transferFromOfflineToDrive = function() {
754 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', 774 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc',
755 'drive_offline', 775 'drive_offline',
756 EXPECTED_FILES_IN_OFFLINE, 776 EXPECTED_FILES_IN_OFFLINE,
757 'drive', 777 'drive',
758 EXPECTED_FILES_BEFORE_DRIVE); 778 EXPECTED_FILES_BEFORE_DRIVE);
759 }; 779 };
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698