Commit d9baca6f authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Chromium LUCI CQ

Files app: Make the flag FilesNg always enabled

Bug: 1102263
Change-Id: I43c12160d9e70959e36a071dea95fe8c2f600ee6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2571033
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833600}
parent 1bb1f3c0
......@@ -729,7 +729,6 @@ std::ostream& operator<<(std::ostream& out,
PRINT_IF_NOT_DEFAULT(arc)
PRINT_IF_NOT_DEFAULT(browser)
PRINT_IF_NOT_DEFAULT(documents_provider)
PRINT_IF_NOT_DEFAULT(files_ng)
PRINT_IF_NOT_DEFAULT(files_swa)
PRINT_IF_NOT_DEFAULT(media_swa)
PRINT_IF_NOT_DEFAULT(mount_volumes)
......@@ -1650,12 +1649,6 @@ void FileManagerBrowserTestBase::SetUpCommandLine(
std::vector<base::Feature> enabled_features;
std::vector<base::Feature> disabled_features;
if (options.files_ng) {
enabled_features.push_back(chromeos::features::kFilesNG);
} else {
disabled_features.push_back(chromeos::features::kFilesNG);
}
if (options.files_swa) {
enabled_features.push_back(chromeos::features::kFilesSWA);
} else {
......
......@@ -79,9 +79,6 @@ class FileManagerBrowserTestBase : public content::DevToolsAgentHostObserver,
// Whether Drive should act as if offline.
bool offline = false;
// Whether test needs the files-ng feature.
bool files_ng = true;
// Whether test needs the files-swa feature.
bool files_swa = false;
......
......@@ -1427,7 +1427,7 @@ util.isFilesCameraFolderEnabled = () => {
* @return {boolean}
*/
util.isFilesNg = () => {
return loadTimeData.getBoolean('FILES_NG_ENABLED');
return true;
};
/**
......
......@@ -787,13 +787,8 @@ class FileManager extends cr.EventTarget {
metrics.recordInterval('Load.InitDocuments');
metrics.startInterval('Load.InitUI');
if (util.isFilesNg()) {
this.document_.documentElement.classList.add('files-ng');
this.dialogDom_.classList.add('files-ng');
} else {
this.document_.documentElement.classList.remove('files-ng');
this.dialogDom_.classList.remove('files-ng');
}
this.document_.documentElement.classList.add('files-ng');
this.dialogDom_.classList.add('files-ng');
this.dialogDom_.classList.toggle(
'camera-folder-enabled', util.isFilesCameraFolderEnabled());
......
......@@ -14,10 +14,6 @@ class FileTableColumnModel extends cr.ui.table.TableColumnModel {
/** @private {?FileTableColumnModel.ColumnSnapshot} */
this.snapshot_ = null;
if (util.isFilesNg()) {
FileTableColumnModel.MIN_WIDTH_ = 40;
}
}
/**
......@@ -296,10 +292,9 @@ function renderHeader_(table) {
/**
* Minimum width of column. Note that is not marked private as it is used in the
* unit tests.
* TODO(lucmult): Revert back to const once FilesNg flag is removed.
* @type {number}
* @const {number}
*/
FileTableColumnModel.MIN_WIDTH_ = 10;
FileTableColumnModel.MIN_WIDTH_ = 40;
/**
* A helper class for performing resizing of columns.
......
......@@ -188,14 +188,32 @@ function testExportAndRestoreColumnConfigWithHidingColumn() {
}
function testNormalizeWidth() {
const newContentWidth = 150;
const expectedWidths = [10, 20, 30, 40, 50];
let newContentWidth = 0;
const initialWidths = [
10 * 17,
20 * 17,
30 * 17,
40 * 17,
50 * 17,
];
// The rounding technique used in the implementation doesn't match floor() or
// ceil(), it diverges by +/- 1. So hard coding here.
const expectedWidths = [
56, // ~(17 * 10 / 3)
114, // ~(17 * 20 / 3)
170, // ~(17 * 30 / 3)
226, // ~(17 * 40 / 3)
284, // ~(17 * 50 / 3)
];
for (let i = 0; i < model.size; i++) {
model.setWidth(i, expectedWidths[i] * 17);
const colWidth = initialWidths[i];
model.setWidth(i, colWidth);
newContentWidth += colWidth;
}
// Resizes columns proportionally
// Reduce total with to 1/3 to Resizes columns proportionally.
newContentWidth = newContentWidth / 3;
model.normalizeWidths(newContentWidth);
assertArrayEquals(expectedWidths, getColumnWidths(model));
......
......@@ -18,7 +18,7 @@
// Use the breadcrumbs to navigate back to Downloads.
await remoteCall.waitAndClickElement(
appId, '#location-breadcrumbs .breadcrumb-path:nth-of-type(2)');
appId, ['bread-crumb', 'button:nth-last-of-type(2)']);
// Wait for the contents of Downloads to load again.
await remoteCall.waitForFiles(appId, TestEntryInfo.getExpectedRows(files));
......@@ -28,33 +28,6 @@
1, await getUserActionCount('FileBrowser.ClickBreadcrumbs'));
};
/**
* Test that clicking on the current directory in the Breadcrumbs doesn't
* leave the focus in the breadcrumbs. crbug.com/944022
*/
testcase.breadcrumbsLeafNoFocus = async () => {
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []);
// Navigate to Downloads/photos.
await remoteCall.navigateWithDirectoryTree(
appId, '/Downloads/photos', 'My files');
// Focus and click on "photos" in the breadcrumbs.
const leafBreadCrumb =
'#location-breadcrumbs .breadcrumb-path.breadcrumb-last';
chrome.test.assertTrue(
!!await remoteCall.callRemoteTestUtil('focus', appId, [leafBreadCrumb]),
'focus failed: ' + leafBreadCrumb);
await remoteCall.waitAndClickElement(appId, leafBreadCrumb);
// Wait focus to not be on breadcrumb clicked.
await remoteCall.waitForElementLost(appId, leafBreadCrumb + ':focus');
// Focus should be on file list.
await remoteCall.waitForElement(appId, '#file-list:focus');
};
/**
* Tests that Downloads is translated in the breadcrumbs.
*/
......@@ -129,44 +102,6 @@
return nestedFolderTestEntries;
}
/**
* Tests that breadcrumbs has to tooltip. crbug.com/951305
*/
testcase.breadcrumbsTooltip = async () => {
// Build an array of nested folder test entries.
const nestedFolderTestEntries = createNestedTestFolders(8);
// Open FilesApp on Downloads containing the test entries.
const appId = await setupAndWaitUntilReady(
RootPath.DOWNLOADS, nestedFolderTestEntries, []);
// Navigate to deepest folder.
const breadcrumb = '/My files/Downloads/' +
nestedFolderTestEntries.map(e => e.nameText).join('/');
await navigateWithDirectoryTree(appId, breadcrumb);
// Get breadcrumb that is "collapsed" in the default window size.
const collapsedBreadcrumb =
await remoteCall.waitForElement(appId, '#breadcrumb-path-8');
// Check: Should have aria-label so screenreader announces the folder name.
chrome.test.assertEq(
'nested-folder6', collapsedBreadcrumb.attributes['aria-label']);
// Check: Should have collapsed attribute so it shows as "...".
chrome.test.assertEq('', collapsedBreadcrumb.attributes['collapsed']);
// Focus the search box.
chrome.test.assertTrue(await remoteCall.callRemoteTestUtil(
'fakeEvent', appId, ['#breadcrumb-path-8', 'focus']));
// Check: The tooltip should be visible and its content is the folder name.
const tooltipQueryVisible = 'files-tooltip[visible=true]';
const tooltip = await remoteCall.waitForElement(appId, tooltipQueryVisible);
const label =
await remoteCall.waitForElement(appId, [tooltipQueryVisible, '#label']);
chrome.test.assertEq('nested-folder6', label.text);
};
/**
* Tests that the breadcrumbs correctly render a short (3 component) path.
*/
......
......@@ -62,15 +62,12 @@ testcase.showMyFiles = async () => {
// Select Downloads folder.
await remoteCall.callRemoteTestUtil('selectVolume', appId, ['downloads']);
// Get the breadcrumbs elements.
const breadcrumbsQuery = ['#location-breadcrumbs .breadcrumb-path'];
const breadcrumbs = await remoteCall.callRemoteTestUtil(
'queryAllElements', appId, breadcrumbsQuery);
// Get the breadcrumbs element.
const breadcrumbs = await remoteCall.waitForElement(appId, ['bread-crumb']);
// Check that My Files is displayed on breadcrumbs.
const expectedBreadcrumbs = 'My files > Downloads';
const resultBreadscrubms = breadcrumbs.map(crumb => crumb.text).join(' > ');
chrome.test.assertEq(expectedBreadcrumbs, resultBreadscrubms);
const expectedBreadcrumbs = 'My files/Downloads';
chrome.test.assertEq(expectedBreadcrumbs, breadcrumbs['attributes']['path']);
};
/**
......
......@@ -46,43 +46,24 @@ testcase.tabindexFocus = async () => {
chrome.test.assertEq('list', element.attributes['class']);
// Send Tab key events to cycle through the tabable elements.
if (await isFilesNg(appId)) {
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'welcome-dismiss'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'drive-welcome-link'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'offline-learn-more'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
} else {
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'welcome-dismiss'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'drive-welcome-link'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
}
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'drive-welcome-link'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'welcome-dismiss'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'offline-learn-more'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
};
/**
......@@ -100,62 +81,20 @@ testcase.tabindexFocusDownloads = async () => {
chrome.test.assertEq('list', element.attributes['class']);
// Send Tab key events to cycle through the tabable elements.
if (await isFilesNg(appId)) {
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'breadcrumbs'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
} else {
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'breadcrumb-path-0'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
}
};
/**
* Tests for background color change when breadcrumb has focus.
*/
testcase.tabindexFocusBreadcrumbBackground = async () => {
// Open Files app on Downloads.
const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS);
// Get background color for breadcrumb with no focus.
const unfocused = await remoteCall.waitForElementStyles(
appId, '#breadcrumb-path-0', ['background-color']);
// Press the tab key.
const result = await sendTestMessage({name: 'dispatchTabKey'});
chrome.test.assertEq(result, 'tabKeyDispatched', 'Tab key dispatch failure');
// Get background color for breadcrumb with focus.
const focused = await remoteCall.waitForElementStyles(
appId, '#breadcrumb-path-0:focus', ['background-color']);
// Check that background colour has changed.
chrome.test.assertFalse(
focused.styles['background-color'] ===
unfocused.styles['background-color']);
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'directory-tree'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'breadcrumbs'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'search-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'view-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'sort-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'gear-button'));
chrome.test.assertTrue(
await remoteCall.checkNextTabFocus(appId, 'file-list'));
};
/**
......@@ -366,7 +305,7 @@ async function tabindexFocus(
/**
* Tests the tab focus behavior of Open Dialog (Downloads).
*/
testcase.tabindexOpenDialogDownloadsFilesNg = async () => {
testcase.tabindexOpenDialogDownloads = async () => {
return tabindexFocus(
{type: 'openFile'}, 'downloads', BASIC_LOCAL_ENTRY_SET,
async (appId) => {
......@@ -379,21 +318,6 @@ testcase.tabindexOpenDialogDownloadsFilesNg = async () => {
]);
};
/**
* Tests the tab focus behavior of Open Dialog (Downloads).
*/
testcase.tabindexOpenDialogDownloads = async () => {
return tabindexFocus(
{type: 'openFile'}, 'downloads', BASIC_LOCAL_ENTRY_SET,
async (appId) => {
await remoteCall.callRemoteTestUtil('selectFile', appId, ['hello.txt']);
},
['#ok-button:not([disabled])'], [
'cancel-button', 'ok-button', 'breadcrumb-path-0', 'search-button',
'view-button', 'sort-button', 'gear-button', 'directory-tree',
'file-list'
]);
};
/**
* Tests the tab focus behavior of Open Dialog (Drive).
......@@ -413,7 +337,7 @@ testcase.tabindexOpenDialogDrive = async () => {
/**
* Tests the tab focus behavior of Save File Dialog (Downloads).
*/
testcase.tabindexSaveFileDialogDownloadsFilesNg = async () => {
testcase.tabindexSaveFileDialogDownloads = async () => {
return tabindexFocus(
{
type: 'saveFile',
......@@ -428,27 +352,11 @@ testcase.tabindexSaveFileDialogDownloadsFilesNg = async () => {
]);
};
/**
* Tests the tab focus behavior of Save File Dialog (Downloads).
*/
testcase.tabindexSaveFileDialogDownloads = async () => {
return tabindexFocus(
{
type: 'saveFile',
suggestedName: 'hoge.txt' // Prevent showing a override prompt
},
'downloads', BASIC_LOCAL_ENTRY_SET, null, ['#ok-button:not([disabled])'],
[
'cancel-button', 'ok-button', 'breadcrumb-path-0', 'search-button',
'view-button', 'sort-button', 'gear-button', 'directory-tree',
'file-list', 'new-folder-button', 'filename-input-textbox'
]);
};
/**
* Tests the tab focus behavior of Save File Dialog (Drive).
*/
testcase.tabindexSaveFileDialogDriveFilesNg = async () => {
testcase.tabindexSaveFileDialogDrive = async () => {
return tabindexFocus(
{
type: 'saveFile',
......@@ -460,19 +368,3 @@ testcase.tabindexSaveFileDialogDriveFilesNg = async () => {
'file-list', 'new-folder-button', 'filename-input-textbox'
]);
};
/**
* Tests the tab focus behavior of Save File Dialog (Drive).
*/
testcase.tabindexSaveFileDialogDrive = async () => {
return tabindexFocus(
{
type: 'saveFile',
suggestedName: 'hoge.txt' // Prevent showing a override prompt
},
'drive', BASIC_DRIVE_ENTRY_SET, null, ['#ok-button:not([disabled])'], [
'cancel-button', 'ok-button', 'search-button', 'view-button',
'sort-button', 'gear-button', 'directory-tree', 'file-list',
'new-folder-button', 'filename-input-textbox'
]);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment