Commit 5c213c4f authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Closure compile progress_center_item_group_unittest

 - remove progress_center_item_group_unittest.html
 - add BUILD rules to auto-generate and compile the unittest
 - fix Closure compile errors

Bug: 910989
Change-Id: I1fc5c09f6d13026b21eee4717dc303ab8beb8ee5
Reviewed-on: https://chromium-review.googlesource.com/c/1356730
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613005}
parent 5a790452
......@@ -29,8 +29,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileOperationHandlerTest) {
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProgressCenterItemGroupTest) {
RunTest(base::FilePath(FILE_PATH_LITERAL(
"foreground/js/progress_center_item_group_unittest.html")));
RunGeneratedTest("/foreground/js/progress_center_item_group_unittest.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, DeviceHandlerTest) {
......
......@@ -533,6 +533,13 @@ js_library("progress_center_item_group") {
]
}
js_unittest("progress_center_item_group_unittest") {
deps = [
":progress_center_item_group",
"//ui/file_manager/base/js:test_error_reporting",
]
}
js_library("providers_model") {
deps = [
"//ui/webui/resources/js:assert",
......@@ -692,6 +699,7 @@ js_library("webui_command_extender") {
js_unit_tests("unit_tests") {
deps = [
":file_list_model_unittest",
":progress_center_item_group_unittest",
":providers_model_unittest",
":spinner_controller_unittest",
":thumbnail_loader_unittest",
......
<!DOCTYPE html>
<!-- Copyright 2014 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.
-->
<html>
<body>
<script src="../../../../webui/resources/js/assert.js"></script>
<script src="../../../../webui/resources/js/cr.js"></script>
<script src="../../../../webui/resources/js/cr/event_target.js"></script>
<script src="../../../../webui/resources/js/load_time_data.js"></script>
<script src="../../common/js/util.js"></script>
<script src="../../common/js/progress_center_common.js"></script>
<script src="progress_center_item_group.js"></script>
<script src="progress_center_item_group_unittest.js"></script>
</body>
</html>
// Copyright 2014 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.
'use strict';
// Prepare the string assets.
// Mock LoadTimeData strings.
window.loadTimeData.data = {
COPY_PROGRESS_SUMMARY: 'Copying...',
ERROR_PROGRESS_SUMMARY: '1 Error.',
......@@ -33,7 +34,7 @@ function testSimpleProgress() {
// Start an animation of the item.
item.progressValue = 0.5;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertEquals(0.5, group.getItem(item.id).progressValue);
......@@ -43,7 +44,7 @@ function testSimpleProgress() {
// Item is completed, but the animation is still on going.
item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent);
......@@ -72,7 +73,7 @@ function testCompleteAnimationDuringProgress() {
item.progressMax = 1.0;
// Add an item.
group.update(item, 0);
group.update(item);
assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message);
......@@ -81,7 +82,7 @@ function testCompleteAnimationDuringProgress() {
// Start an animation of the item.
item.progressValue = 0.5;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertEquals(0.5, group.getItem(item.id).progressValue);
......@@ -105,7 +106,7 @@ function testCompleteAnimationDuringProgress() {
// The item is completed. The animation to 100% progress starts.
item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent);
......@@ -135,7 +136,7 @@ function testAddMaxProgressItem() {
item.progressValue = 1.0;
// Add an item with 100% progress.
group.update(item, 0);
group.update(item);
assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message);
......@@ -143,9 +144,8 @@ function testAddMaxProgressItem() {
assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state);
// Complete the item without animation.
item.progressValue = null;
item.state = ProgressItemState.COMPLETED;
group.update(item, 0);
group.update(item);
assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated());
assertEquals(null, group.getItem(item.id));
......@@ -163,7 +163,7 @@ function testCompleteDuringAnimation() {
item.progressValue = 0.0;
// Add an item.
group.update(item, 0);
group.update(item);
assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message);
......@@ -172,7 +172,7 @@ function testCompleteDuringAnimation() {
// Update the progress of the item to 100%. The animation starts.
item.progressValue = 1.0;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message);
......@@ -180,9 +180,8 @@ function testCompleteDuringAnimation() {
assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state);
// Complete the item. The animation is still on going.
item.progressValue = null;
item.state = ProgressItemState.COMPLETED;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated());
assertTrue(!!group.getItem(item.id));
......@@ -300,7 +299,7 @@ function testOneError() {
assertTrue(!!group.getItem(item1.id));
assertFalse(group.isAnimated(item1.id));
assertEquals(null, group.getSummarizedItem());
assertEquals(null, group.getSummarizedItem(0));
assertFalse(group.isSummarizedAnimated());
assertEquals(ProgressCenterItemGroup.State.INACTIVE, group.state);
......@@ -579,7 +578,7 @@ function testQuietItem() {
// Start an animation of the item.
item.progressValue = 0.5;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
// Summarized item should not animated because the panel does not show
// progress bar for quiet and summarized item.
......@@ -591,7 +590,7 @@ function testQuietItem() {
// Item is completed, but the animation is still on going.
item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED;
group.update(item, 0);
group.update(item);
assertTrue(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent);
......
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