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
3 // found in the LICENSE file.
8 * Tests restoring the sorting order.
10 testcase.restoreSortColumn = function() {
12 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([
20 // Set up File Manager.
22 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
27 callRemoteTestUtil('fakeMouseClick',
29 ['.table-header-cell:nth-of-type(1)'],
32 // Check the sorted style of the header.
34 waitForElement(appId, '.table-header-sort-image-asc').then(this.next);
38 callRemoteTestUtil('fakeMouseClick',
40 ['.table-header-cell:nth-of-type(1)'],
43 // Check the sorted style of the header.
45 waitForElement(appId, '.table-header-sort-image-desc').
48 // Check the sorted files.
50 waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}).then(this.next);
52 // Open another window, where the sorted column should be restored.
54 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
56 // Check the sorted style of the header.
59 waitForElement(appId, '.table-header-sort-image-desc').
62 // Check the sorted files.
64 waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}).then(this.next);
68 checkIfNoErrorsOccured(this.next);
74 * Tests restoring the current view (the file list or the thumbnail grid).
76 testcase.restoreCurrentView = function() {
79 // Set up File Manager.
81 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
83 // Check the initial view.
86 waitForElement(appId, '.thumbnail-grid[hidden]').then(this.next);
88 // Opens the gear menu.
90 callRemoteTestUtil('fakeMouseClick',
95 // Change the current view.
97 callRemoteTestUtil('fakeMouseClick',
102 // Check the new current view.
104 chrome.test.assertTrue(result);
105 waitForElement(appId, '.detail-table[hidden]').then(this.next);
107 // Open another window, where the current view is restored.
109 openNewWindow(null, RootPath.DOWNLOADS, this.next);
111 // Check the current view.
114 waitForElement(appId, '.detail-table[hidden]').then(this.next);
118 checkIfNoErrorsOccured(this.next);