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) { ...@@ -181,8 +181,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesTooltip) {
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, SpinnerController) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, SpinnerController) {
RunTest(base::FilePath( RunGeneratedTest("/foreground/js/spinner_controller_unittest.html");
FILE_PATH_LITERAL("foreground/js/spinner_controller_unittest.html")));
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileListModel) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileListModel) {
......
...@@ -619,6 +619,15 @@ js_library("spinner_controller") { ...@@ -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") { js_library("task_controller") {
deps = [ deps = [
":dialog_type", ":dialog_type",
...@@ -684,6 +693,7 @@ js_unit_tests("unit_tests") { ...@@ -684,6 +693,7 @@ js_unit_tests("unit_tests") {
deps = [ deps = [
":file_list_model_unittest", ":file_list_model_unittest",
":providers_model_unittest", ":providers_model_unittest",
":spinner_controller_unittest",
":thumbnail_loader_unittest", ":thumbnail_loader_unittest",
] ]
} }
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
* is called 3 times, the hide callback has to be called 3 times to make the * is called 3 times, the hide callback has to be called 3 times to make the
* spinner invisible. * spinner invisible.
* *
* @param {!HTMLElement} element * @param {!Element} element
* @constructor * @constructor
* @extends {cr.EventTarget} * @extends {cr.EventTarget}
*/ */
function SpinnerController(element) { function SpinnerController(element) {
/** /**
* The container element of the file list. * The container element of the file list.
* @type {!HTMLElement} * @type {!Element}
* @const * @const
* @private * @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 @@ ...@@ -2,7 +2,14 @@
// 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.
/**
* @type {Element}
*/
var spinner; var spinner;
/**
* @type {SpinnerController}
*/
var controller; var controller;
function waitForMutation(target) { function waitForMutation(target) {
...@@ -16,8 +23,11 @@ function waitForMutation(target) { ...@@ -16,8 +23,11 @@ function waitForMutation(target) {
} }
function setUp() { function setUp() {
spinner = document.querySelector('#spinner'); spinner = document.createElement('div');
controller = new SpinnerController(spinner); 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 // Set the duration to 100ms, which is short enough, but also long enough
// to happen later than 0ms timers used in test cases. // to happen later than 0ms timers used in test cases.
controller.setBlinkDurationForTesting(100); 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