OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 'use strict'; | |
6 | |
7 /** | |
8 * Tests if the files initially added by the C++ side are displayed, and | |
9 * that a subsequently added file shows up. | |
10 * | |
11 * @param {string} path Directory path to be tested. | |
12 */ | |
13 function fileDisplay(path) { | |
14 var appId; | |
15 | |
16 var expectedFilesBefore = | |
17 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? | |
18 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | |
19 | |
20 var expectedFilesAfter = | |
21 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); | |
22 | |
23 StepsRunner.run([ | |
24 function() { | |
25 setupAndWaitUntilReady(null, path, this.next); | |
26 }, | |
27 // Notify that the list has been verified and a new file can be added | |
28 // in file_manager_browsertest.cc. | |
29 function(inAppId, actualFilesBefore) { | |
30 appId = inAppId; | |
31 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); | |
32 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); | |
33 }, | |
34 function(result) { | |
35 chrome.test.assertTrue(result); | |
36 waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); | |
37 }, | |
38 // Confirm the file list. | |
39 function(actualFilesAfter) { | |
40 chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); | |
41 checkIfNoErrorsOccured(this.next); | |
42 }, | |
43 ]); | |
44 } | |
45 | |
46 testcase.fileDisplayDownloads = function() { | |
47 fileDisplay(RootPath.DOWNLOADS); | |
48 }; | |
49 | |
50 testcase.fileDisplayDrive = function() { | |
51 fileDisplay(RootPath.DRIVE); | |
52 }; | |
OLD | NEW |