Commit 628ff087 authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Closure compile spinner_controller_unittest.

Bug: 907963
Change-Id: I2c7d91fa0d702b67d9b42e758030d1154dee9e2d
Reviewed-on: https://chromium-review.googlesource.com/c/1349144Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610538}
parent 8da298bf
......@@ -181,8 +181,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesTooltip) {
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, SpinnerController) {
RunTest(base::FilePath(
FILE_PATH_LITERAL("foreground/js/spinner_controller_unittest.html")));
RunGeneratedTest("/foreground/js/spinner_controller_unittest.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileListModel) {
......
......@@ -619,6 +619,15 @@ js_library("spinner_controller") {
]
}
js_unittest("spinner_controller_unittest") {
deps = [
":spinner_controller",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:util",
]
}
js_library("task_controller") {
deps = [
":dialog_type",
......@@ -684,6 +693,7 @@ js_unit_tests("unit_tests") {
deps = [
":file_list_model_unittest",
":providers_model_unittest",
":spinner_controller_unittest",
":thumbnail_loader_unittest",
]
}
......@@ -7,14 +7,14 @@
* is called 3 times, the hide callback has to be called 3 times to make the
* spinner invisible.
*
* @param {!HTMLElement} element
* @param {!Element} element
* @constructor
* @extends {cr.EventTarget}
*/
function SpinnerController(element) {
/**
* The container element of the file list.
* @type {!HTMLElement}
* @type {!Element}
* @const
* @private
*/
......
<!DOCTYPE html>
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-->
<div id="spinner" hidden>LOADING...</div>
<script src="../../../../webui/resources/js/assert.js"></script>
<script src="../../../../webui/resources/js/util.js"></script>
<script src="../../../base/js/test_error_reporting.js"></script>
<script src="spinner_controller.js"></script>
<script src="spinner_controller_unittest.js"></script>
......@@ -2,7 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @type {Element}
*/
var spinner;
/**
* @type {SpinnerController}
*/
var controller;
function waitForMutation(target) {
......@@ -16,8 +23,11 @@ function waitForMutation(target) {
}
function setUp() {
spinner = document.querySelector('#spinner');
controller = new SpinnerController(spinner);
spinner = document.createElement('div');
spinner.id = 'spinner';
spinner.textContent = 'LOADING...';
spinner.hidden = true;
controller = new SpinnerController(assert(spinner));
// Set the duration to 100ms, which is short enough, but also long enough
// to happen later than 0ms timers used in test cases.
controller.setBlinkDurationForTesting(100);
......
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