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

Files app: Generate JS module for //u/f/f/b/j/task_queue_unittest.m.js

Bug: 1133186
Change-Id: Ibf708111708cca3df426ef80421e3421c3d68a7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593801
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJeremie Boulic <jboulic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837926}
parent 1751985a
...@@ -234,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, TaskController) { ...@@ -234,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, TaskController) {
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, TaskQueueTest) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, TaskQueueTest) {
RunTestURL("background/js/task_queue_unittest_gen.html"); RunTestURL("background/js/task_queue_unittest.m_gen.html");
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ThumbnailLoader) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ThumbnailLoader) {
......
...@@ -718,18 +718,14 @@ js_library("task_queue") { ...@@ -718,18 +718,14 @@ js_library("task_queue") {
externs_list = [ "//ui/file_manager/externs/background/task_queue.js" ] externs_list = [ "//ui/file_manager/externs/background/task_queue.js" ]
} }
js_unittest("task_queue_unittest") { js_unittest("task_queue_unittest.m") {
deps = [ deps = [
":task_queue", ":task_queue.m",
"//ui/file_manager/base/js:test_error_reporting", "//chrome/test/data/webui:chai_assert",
"//ui/file_manager/base/js:volume_manager_types", "//ui/file_manager/base/js:test_error_reporting.m",
"//ui/file_manager/file_manager/common/js:importer_common", "//ui/file_manager/externs/background:task_queue.m",
"//ui/file_manager/file_manager/common/js:progress_center_common", "//ui/file_manager/file_manager/common/js:importer_common.m",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js/cr:event_target",
] ]
externs_list = [ "//ui/file_manager/externs/background/task_queue.js" ]
} }
js_library("task_queue.m") { js_library("task_queue.m") {
...@@ -900,6 +896,7 @@ js_test_gen_html("js_test_gen_html_modules") { ...@@ -900,6 +896,7 @@ js_test_gen_html("js_test_gen_html_modules") {
":crostini_unittest.m", ":crostini_unittest.m",
":metadata_proxy_unittest.m", ":metadata_proxy_unittest.m",
":mount_metrics_unittest.m", ":mount_metrics_unittest.m",
":task_queue_unittest.m",
] ]
js_module = true js_module = true
...@@ -922,7 +919,6 @@ js_test_gen_html("js_test_gen_html") { ...@@ -922,7 +919,6 @@ js_test_gen_html("js_test_gen_html") {
":import_history_unittest", ":import_history_unittest",
":media_import_handler_unittest", ":media_import_handler_unittest",
":media_scanner_unittest", ":media_scanner_unittest",
":task_queue_unittest",
":trash_unittest", ":trash_unittest",
":volume_manager_unittest", ":volume_manager_unittest",
] ]
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import {assertEquals, assertFalse, assertTrue} from 'chrome://test/chai_assert.js';
import {reportPromise} from '../../../base/js/test_error_reporting.m.js';
import {taskQueueInterfaces} from '../../../externs/background/task_queue.m.js';
import {importer} from '../../common/js/importer_common.m.js';
import {taskQueue} from './task_queue.m.js';
/** @type {!taskQueueInterfaces.TaskQueue} */ /** @type {!taskQueueInterfaces.TaskQueue} */
let queue; let queue;
/** @type {!Object<importer.UpdateType, number>} */ /** @type {!Object<importer.UpdateType, number>} */
const updates = {}; const updates = {};
function setUp() { export function setUp() {
queue = new taskQueue.TaskQueueImpl(); queue = new taskQueue.TaskQueueImpl();
// Set up a callback to log updates from running tasks. // Set up a callback to log updates from running tasks.
...@@ -80,14 +88,14 @@ class TestTask extends taskQueue.BaseTaskImpl { ...@@ -80,14 +88,14 @@ class TestTask extends taskQueue.BaseTaskImpl {
} }
// Verifies that a queued task gets run. // Verifies that a queued task gets run.
function testRunsTask(callback) { export function testRunsTask(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
queue.queueTask(task); queue.queueTask(task);
reportPromise(task.whenRun(), callback); reportPromise(task.whenRun(), callback);
} }
// Verifies that multiple queued tasks get run. // Verifies that multiple queued tasks get run.
function testRunsTasks(callback) { export function testRunsTasks(callback) {
const task0 = new TestTask('task0'); const task0 = new TestTask('task0');
const task1 = new TestTask('task1'); const task1 = new TestTask('task1');
...@@ -106,7 +114,7 @@ function testRunsTasks(callback) { ...@@ -106,7 +114,7 @@ function testRunsTasks(callback) {
} }
// Verifies that the active callback triggers when the queue starts doing work // Verifies that the active callback triggers when the queue starts doing work
function testOnActiveCalled(callback) { export function testOnActiveCalled(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
// Make a promise that resolves when the active callback is triggered. // Make a promise that resolves when the active callback is triggered.
...@@ -124,7 +132,7 @@ function testOnActiveCalled(callback) { ...@@ -124,7 +132,7 @@ function testOnActiveCalled(callback) {
} }
// Verifies that the idle callback triggers when the queue is empty. // Verifies that the idle callback triggers when the queue is empty.
function testOnIdleCalled(callback) { export function testOnIdleCalled(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
task.whenRun().then(task => { task.whenRun().then(task => {
...@@ -147,7 +155,7 @@ function testOnIdleCalled(callback) { ...@@ -147,7 +155,7 @@ function testOnIdleCalled(callback) {
} }
// Verifies that the update callback is called when a task reports progress. // Verifies that the update callback is called when a task reports progress.
function testProgressUpdate(callback) { export function testProgressUpdate(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
// Get the task to report some progress, then success, when it's run. // Get the task to report some progress, then success, when it's run.
...@@ -176,7 +184,7 @@ function testProgressUpdate(callback) { ...@@ -176,7 +184,7 @@ function testProgressUpdate(callback) {
// Verifies that the update callback is called to report successful task // Verifies that the update callback is called to report successful task
// completion. // completion.
function testSuccessUpdate(callback) { export function testSuccessUpdate(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
// Get the task to report success when it's run. // Get the task to report success when it's run.
...@@ -198,7 +206,7 @@ function testSuccessUpdate(callback) { ...@@ -198,7 +206,7 @@ function testSuccessUpdate(callback) {
} }
// Verifies that the update callback is called to report task errors. // Verifies that the update callback is called to report task errors.
function testErrorUpdate(callback) { export function testErrorUpdate(callback) {
const task = new TestTask('task0'); const task = new TestTask('task0');
// Get the task to report an error when it's run. // Get the task to report an error when it's run.
...@@ -222,7 +230,7 @@ function testErrorUpdate(callback) { ...@@ -222,7 +230,7 @@ function testErrorUpdate(callback) {
reportPromise(whenDone, callback); reportPromise(whenDone, callback);
} }
function testOnTaskCancelled(callback) { export function testOnTaskCancelled(callback) {
const task0 = new TestTask('task0'); const task0 = new TestTask('task0');
const task1 = new TestTask('task1'); const task1 = new TestTask('task1');
......
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