OLD | NEW |
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 462 } |
463 chrome.test.assertTrue(copiedItem != null); | 463 chrome.test.assertTrue(copiedItem != null); |
464 for (var i = 0; i < dstContents.length; i++) { | 464 for (var i = 0; i < dstContents.length; i++) { |
465 if (dstContents[i][0] == targetFile) { | 465 if (dstContents[i][0] == targetFile) { |
466 // Replace the last '.' in filename with ' (1).'. | 466 // Replace the last '.' in filename with ' (1).'. |
467 // e.g. 'my.note.txt' -> 'my.note (1).txt' | 467 // e.g. 'my.note.txt' -> 'my.note (1).txt' |
468 copiedItem[0] = copiedItem[0].replace(/\.(?=[^\.]+$)/, ' (1).'); | 468 copiedItem[0] = copiedItem[0].replace(/\.(?=[^\.]+$)/, ' (1).'); |
469 break; | 469 break; |
470 } | 470 } |
471 } | 471 } |
472 // File size can not be obtained on drive_shared_with_me volume. | 472 // File size can not be obtained on drive_shared_with_me volume and |
| 473 // drive_offline. |
473 var ignoreSize = srcName == 'drive_shared_with_me' || | 474 var ignoreSize = srcName == 'drive_shared_with_me' || |
474 dstName == 'drive_shared_with_me'; | 475 dstName == 'drive_shared_with_me' || |
| 476 srcName == 'drive_offline' || |
| 477 dstName == 'drive_offline'; |
475 for (var i = 0; i < actualFilesAfter.length; i++) { | 478 for (var i = 0; i < actualFilesAfter.length; i++) { |
476 if (actualFilesAfter[i][0] == copiedItem[0] && | 479 if (actualFilesAfter[i][0] == copiedItem[0] && |
477 (ignoreSize || actualFilesAfter[i][1] == copiedItem[1]) && | 480 (ignoreSize || actualFilesAfter[i][1] == copiedItem[1]) && |
478 actualFilesAfter[i][2] == copiedItem[2]) { | 481 actualFilesAfter[i][2] == copiedItem[2]) { |
479 chrome.test.succeed(); | 482 chrome.test.succeed(); |
480 return; | 483 return; |
481 } | 484 } |
482 } | 485 } |
483 chrome.test.fail(); | 486 chrome.test.fail(); |
484 } | 487 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 /** | 570 /** |
568 * Tests copy from drive's offline to drive's root. | 571 * Tests copy from drive's offline to drive's root. |
569 */ | 572 */ |
570 testcase.transferFromOfflineToDrive = function() { | 573 testcase.transferFromOfflineToDrive = function() { |
571 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', | 574 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', |
572 'drive_offline', | 575 'drive_offline', |
573 EXPECTED_FILES_IN_OFFLINE, | 576 EXPECTED_FILES_IN_OFFLINE, |
574 'drive', | 577 'drive', |
575 EXPECTED_FILES_BEFORE_DRIVE); | 578 EXPECTED_FILES_BEFORE_DRIVE); |
576 }; | 579 }; |
OLD | NEW |