Files TS: Build clean ups #2
Bug: b:319189127
Change-Id: I8681bec9fcfcd2fd485ded5f8433b0997066316c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5300617
Reviewed-by: François Degros <fdegros@chromium.org>
Commit-Queue: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1261488}
diff --git a/ui/file_manager/integration_tests/BUILD.gn b/ui/file_manager/integration_tests/BUILD.gn
index 439bf6ce..b1e43de4 100644
--- a/ui/file_manager/integration_tests/BUILD.gn
+++ b/ui/file_manager/integration_tests/BUILD.gn
@@ -7,14 +7,11 @@
preprocess_folder = "$target_gen_dir/preprocessed"
tsc_folder = "$target_gen_dir/tsc"
-js_files = [ "test_util.ts" ]
-
ts_files = [
"remote_call.ts",
+ "test_util.ts",
"testcase.ts",
- # "test_util.ts",
-
# File Manager.
"file_manager/android_photos.ts",
"file_manager/background.ts",
@@ -77,7 +74,7 @@
# TS/JS files.
copy("copy_src") {
- sources = js_files + ts_files
+ sources = ts_files
outputs = [ "$preprocess_folder/{{source_target_relative}}" ]
}
@@ -118,7 +115,7 @@
":from_files_app",
]
- in_files = js_files + ts_files + [
+ in_files = ts_files + [
# Copied from the Files app production to avoid duplication.
"prod/file_manager/shared_types.ts",
]
diff --git a/ui/file_manager/integration_tests/definitions.d.ts b/ui/file_manager/integration_tests/definitions.d.ts
index b968c63..97e944fd 100644
--- a/ui/file_manager/integration_tests/definitions.d.ts
+++ b/ui/file_manager/integration_tests/definitions.d.ts
@@ -10,17 +10,6 @@
currentStep: Promise<void>|null;
}
-
-// Copied from the fileManagerPrivate.
-// TODO(TS): Remove this interface when file_manager_private.d.ts is
-// auto-generated and submitted.
-interface FileTaskDescriptor {
- appId: string;
- taskType: string;
- actionId: string;
-}
-
-
// TODO(b/319189127): Remove these when the integration tests extension is
// migrated to manifest v3 and can use the Promise version of these APIs.
declare namespace chrome {
diff --git a/ui/file_manager/integration_tests/file_manager/background.ts b/ui/file_manager/integration_tests/file_manager/background.ts
index 8273bf73..bc2490e 100644
--- a/ui/file_manager/integration_tests/file_manager/background.ts
+++ b/ui/file_manager/integration_tests/file_manager/background.ts
@@ -2,24 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import './context_menu.js';
-import './create_new_folder.js';
-import './crostini.js';
-import './directory_tree_context_menu.js';
-import './dlp.js';
-import './dlp_enterprise_connectors.js';
-import './drive_specific.js';
-import './file_dialog.js';
-import './file_transfer_connector.js';
-import './folder_shortcuts.js';
-import './gear_menu.js';
-import './holding_space.js';
-import './install_linux_package_dialog.js';
-import './recents.js';
-import './search.js';
-import './tab_index.js';
-import './transfer.js';
-
import {FilesAppState} from '../prod/file_manager/shared_types.js';
import {RemoteCallFilesApp} from '../remote_call.js';
import {addEntries, getCaller, GetRootPathsResult, pending, repeatUntil, RootPath, sendBrowserTestCommand, sendTestMessage, TestEntryInfo} from '../test_util.js';
diff --git a/ui/file_manager/integration_tests/file_manager/office.ts b/ui/file_manager/integration_tests/file_manager/office.ts
index 79f678c..aba1f17 100644
--- a/ui/file_manager/integration_tests/file_manager/office.ts
+++ b/ui/file_manager/integration_tests/file_manager/office.ts
@@ -10,7 +10,8 @@
/**
* Returns 'Open in Google Docs' task descriptor.
*/
-function openDocWithDriveDescriptor(): FileTaskDescriptor {
+function openDocWithDriveDescriptor():
+ chrome.fileManagerPrivate.FileTaskDescriptor {
const filesAppId = FILE_MANAGER_SWA_APP_ID;
const filesTaskType = 'web';
const actionId = `${FILE_SWA_BASE_URL}?open-web-drive-office-word`;
@@ -21,7 +22,8 @@
/**
* Returns 'Open with Excel' task descriptor.
*/
-function openExcelWithDriveDescriptor(): FileTaskDescriptor {
+function openExcelWithDriveDescriptor():
+ chrome.fileManagerPrivate.FileTaskDescriptor {
const filesAppId = FILE_MANAGER_SWA_APP_ID;
const filesTaskType = 'web';
const actionId = `${FILE_SWA_BASE_URL}?open-web-drive-office-excel`;
@@ -32,7 +34,8 @@
/**
* Returns 'Open in PowerPoint' task descriptor.
*/
-function openPowerPointWithDriveDescriptor(): FileTaskDescriptor {
+function openPowerPointWithDriveDescriptor():
+ chrome.fileManagerPrivate.FileTaskDescriptor {
const filesAppId = FILE_MANAGER_SWA_APP_ID;
const filesTaskType = 'web';
const actionId = `${FILE_SWA_BASE_URL}?open-web-drive-office-powerpoint`;
@@ -47,8 +50,8 @@
*
* @param appId Window ID.
*/
-async function getExecutedTask(
- appId: string, expectedCount: number = 1): Promise<FileTaskDescriptor> {
+async function getExecutedTask(appId: string, expectedCount: number = 1):
+ Promise<chrome.fileManagerPrivate.FileTaskDescriptor> {
const caller = getCaller();
// Wait until a task has been executed.
@@ -63,10 +66,10 @@
});
// Arguments provided for the last call to executeTask().
- const executeTaskArgs =
- (await remoteCall.callRemoteTestUtil<FileTaskDescriptor[][]>(
- 'staticFakeCalledArgs', appId,
- ['chrome.fileManagerPrivate.executeTask']))[expectedCount - 1]!;
+ const executeTaskArgs = (await remoteCall.callRemoteTestUtil<
+ chrome.fileManagerPrivate.FileTaskDescriptor[][]>(
+ 'staticFakeCalledArgs', appId,
+ ['chrome.fileManagerPrivate.executeTask']))[expectedCount - 1]!;
// The task descriptor is the first argument.
return executeTaskArgs[0]!;
diff --git a/ui/file_manager/integration_tests/file_manager/tasks.ts b/ui/file_manager/integration_tests/file_manager/tasks.ts
index b304a0fb..e29498a 100644
--- a/ui/file_manager/integration_tests/file_manager/tasks.ts
+++ b/ui/file_manager/integration_tests/file_manager/tasks.ts
@@ -62,7 +62,7 @@
* @param descriptor Task descriptor.
*/
async function executeDefaultTask(
- appId: string, descriptor: FileTaskDescriptor) {
+ appId: string, descriptor: chrome.fileManagerPrivate.FileTaskDescriptor) {
// Select file.
await remoteCall.waitUntilSelected(appId, 'hello.txt');
@@ -84,7 +84,8 @@
* @return Promise to be fulfilled/rejected depends on the test result.
*/
async function defaultTaskDialog(
- appId: string, descriptor: FileTaskDescriptor): Promise<void> {
+ appId: string,
+ descriptor: chrome.fileManagerPrivate.FileTaskDescriptor): Promise<void> {
// Prepare expected labels.
const expectedLabels = [
'DummyTask1 (default)',
diff --git a/ui/file_manager/integration_tests/file_manager/test_data.ts b/ui/file_manager/integration_tests/file_manager/test_data.ts
index 1845f7d..dfd16901 100644
--- a/ui/file_manager/integration_tests/file_manager/test_data.ts
+++ b/ui/file_manager/integration_tests/file_manager/test_data.ts
@@ -248,7 +248,8 @@
* @param isDlpBlocked Whether the task is blocked by DLP.
*/
constructor(
- public isDefault: boolean, public descriptor: FileTaskDescriptor,
+ public isDefault: boolean,
+ public descriptor: chrome.fileManagerPrivate.FileTaskDescriptor,
public title?: string, public isGenericFileHandler: boolean = false,
public isDlpBlocked: boolean = false) {
Object.freeze(this);
diff --git a/ui/file_manager/integration_tests/remote_call.ts b/ui/file_manager/integration_tests/remote_call.ts
index 0cfb86a2..c180ead 100644
--- a/ui/file_manager/integration_tests/remote_call.ts
+++ b/ui/file_manager/integration_tests/remote_call.ts
@@ -661,15 +661,16 @@
* list.
*/
waitUntilTaskExecutes(
- appId: string, descriptor: FileTaskDescriptor, fileNames: string[],
- replyArgs?: Object[]): Promise<void> {
+ appId: string, descriptor: chrome.fileManagerPrivate.FileTaskDescriptor,
+ fileNames: string[], replyArgs?: Object[]): Promise<void> {
const caller = getCaller();
return repeatUntil(async () => {
if (!await this.callRemoteTestUtil(
'taskWasExecuted', appId, [descriptor, fileNames])) {
- const tasks = await this.callRemoteTestUtil<
- Array<{descriptor: FileTaskDescriptor, fileNames: string[]}>>(
- 'getExecutedTasks', appId, []);
+ const tasks = await this.callRemoteTestUtil<Array<{
+ descriptor: chrome.fileManagerPrivate.FileTaskDescriptor,
+ fileNames: string[],
+ }>>('getExecutedTasks', appId, []);
const executedTasks = tasks.map((task) => {
const {appId, taskType, actionId} = task.descriptor;
const executedFileNames = task.fileNames;