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) { ...@@ -29,8 +29,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileOperationHandlerTest) {
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProgressCenterItemGroupTest) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProgressCenterItemGroupTest) {
RunTest(base::FilePath(FILE_PATH_LITERAL( RunGeneratedTest("/foreground/js/progress_center_item_group_unittest.html");
"foreground/js/progress_center_item_group_unittest.html")));
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, DeviceHandlerTest) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, DeviceHandlerTest) {
......
...@@ -533,6 +533,13 @@ js_library("progress_center_item_group") { ...@@ -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") { js_library("providers_model") {
deps = [ deps = [
"//ui/webui/resources/js:assert", "//ui/webui/resources/js:assert",
...@@ -692,6 +699,7 @@ js_library("webui_command_extender") { ...@@ -692,6 +699,7 @@ js_library("webui_command_extender") {
js_unit_tests("unit_tests") { js_unit_tests("unit_tests") {
deps = [ deps = [
":file_list_model_unittest", ":file_list_model_unittest",
":progress_center_item_group_unittest",
":providers_model_unittest", ":providers_model_unittest",
":spinner_controller_unittest", ":spinner_controller_unittest",
":thumbnail_loader_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. // Copyright 2014 The Chromium Authors. All rights reserved.
// 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.
'use strict'; 'use strict';
// Prepare the string assets. // Mock LoadTimeData strings.
window.loadTimeData.data = { window.loadTimeData.data = {
COPY_PROGRESS_SUMMARY: 'Copying...', COPY_PROGRESS_SUMMARY: 'Copying...',
ERROR_PROGRESS_SUMMARY: '1 Error.', ERROR_PROGRESS_SUMMARY: '1 Error.',
...@@ -33,7 +34,7 @@ function testSimpleProgress() { ...@@ -33,7 +34,7 @@ function testSimpleProgress() {
// Start an animation of the item. // Start an animation of the item.
item.progressValue = 0.5; item.progressValue = 0.5;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertEquals(0.5, group.getItem(item.id).progressValue); assertEquals(0.5, group.getItem(item.id).progressValue);
...@@ -43,7 +44,7 @@ function testSimpleProgress() { ...@@ -43,7 +44,7 @@ function testSimpleProgress() {
// Item is completed, but the animation is still on going. // Item is completed, but the animation is still on going.
item.progressValue = 1.0; item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED; item.state = ProgressItemState.COMPLETED;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent); assertEquals(100, group.getItem(item.id).progressRateInPercent);
...@@ -72,7 +73,7 @@ function testCompleteAnimationDuringProgress() { ...@@ -72,7 +73,7 @@ function testCompleteAnimationDuringProgress() {
item.progressMax = 1.0; item.progressMax = 1.0;
// Add an item. // Add an item.
group.update(item, 0); group.update(item);
assertFalse(group.isAnimated(item.id)); assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message); assertEquals('TestItemMessage1', group.getItem(item.id).message);
...@@ -81,7 +82,7 @@ function testCompleteAnimationDuringProgress() { ...@@ -81,7 +82,7 @@ function testCompleteAnimationDuringProgress() {
// Start an animation of the item. // Start an animation of the item.
item.progressValue = 0.5; item.progressValue = 0.5;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertEquals(0.5, group.getItem(item.id).progressValue); assertEquals(0.5, group.getItem(item.id).progressValue);
...@@ -105,7 +106,7 @@ function testCompleteAnimationDuringProgress() { ...@@ -105,7 +106,7 @@ function testCompleteAnimationDuringProgress() {
// The item is completed. The animation to 100% progress starts. // The item is completed. The animation to 100% progress starts.
item.progressValue = 1.0; item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED; item.state = ProgressItemState.COMPLETED;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent); assertEquals(100, group.getItem(item.id).progressRateInPercent);
...@@ -135,7 +136,7 @@ function testAddMaxProgressItem() { ...@@ -135,7 +136,7 @@ function testAddMaxProgressItem() {
item.progressValue = 1.0; item.progressValue = 1.0;
// Add an item with 100% progress. // Add an item with 100% progress.
group.update(item, 0); group.update(item);
assertFalse(group.isAnimated(item.id)); assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message); assertEquals('TestItemMessage1', group.getItem(item.id).message);
...@@ -143,9 +144,8 @@ function testAddMaxProgressItem() { ...@@ -143,9 +144,8 @@ function testAddMaxProgressItem() {
assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state); assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state);
// Complete the item without animation. // Complete the item without animation.
item.progressValue = null;
item.state = ProgressItemState.COMPLETED; item.state = ProgressItemState.COMPLETED;
group.update(item, 0); group.update(item);
assertFalse(group.isAnimated(item.id)); assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals(null, group.getItem(item.id)); assertEquals(null, group.getItem(item.id));
...@@ -163,7 +163,7 @@ function testCompleteDuringAnimation() { ...@@ -163,7 +163,7 @@ function testCompleteDuringAnimation() {
item.progressValue = 0.0; item.progressValue = 0.0;
// Add an item. // Add an item.
group.update(item, 0); group.update(item);
assertFalse(group.isAnimated(item.id)); assertFalse(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message); assertEquals('TestItemMessage1', group.getItem(item.id).message);
...@@ -172,7 +172,7 @@ function testCompleteDuringAnimation() { ...@@ -172,7 +172,7 @@ function testCompleteDuringAnimation() {
// Update the progress of the item to 100%. The animation starts. // Update the progress of the item to 100%. The animation starts.
item.progressValue = 1.0; item.progressValue = 1.0;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertEquals('TestItemMessage1', group.getItem(item.id).message); assertEquals('TestItemMessage1', group.getItem(item.id).message);
...@@ -180,9 +180,8 @@ function testCompleteDuringAnimation() { ...@@ -180,9 +180,8 @@ function testCompleteDuringAnimation() {
assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state); assertEquals(ProgressCenterItemGroup.State.ACTIVE, group.state);
// Complete the item. The animation is still on going. // Complete the item. The animation is still on going.
item.progressValue = null;
item.state = ProgressItemState.COMPLETED; item.state = ProgressItemState.COMPLETED;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertTrue(group.isSummarizedAnimated()); assertTrue(group.isSummarizedAnimated());
assertTrue(!!group.getItem(item.id)); assertTrue(!!group.getItem(item.id));
...@@ -300,7 +299,7 @@ function testOneError() { ...@@ -300,7 +299,7 @@ function testOneError() {
assertTrue(!!group.getItem(item1.id)); assertTrue(!!group.getItem(item1.id));
assertFalse(group.isAnimated(item1.id)); assertFalse(group.isAnimated(item1.id));
assertEquals(null, group.getSummarizedItem()); assertEquals(null, group.getSummarizedItem(0));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals(ProgressCenterItemGroup.State.INACTIVE, group.state); assertEquals(ProgressCenterItemGroup.State.INACTIVE, group.state);
...@@ -579,7 +578,7 @@ function testQuietItem() { ...@@ -579,7 +578,7 @@ function testQuietItem() {
// Start an animation of the item. // Start an animation of the item.
item.progressValue = 0.5; item.progressValue = 0.5;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
// Summarized item should not animated because the panel does not show // Summarized item should not animated because the panel does not show
// progress bar for quiet and summarized item. // progress bar for quiet and summarized item.
...@@ -591,7 +590,7 @@ function testQuietItem() { ...@@ -591,7 +590,7 @@ function testQuietItem() {
// Item is completed, but the animation is still on going. // Item is completed, but the animation is still on going.
item.progressValue = 1.0; item.progressValue = 1.0;
item.state = ProgressItemState.COMPLETED; item.state = ProgressItemState.COMPLETED;
group.update(item, 0); group.update(item);
assertTrue(group.isAnimated(item.id)); assertTrue(group.isAnimated(item.id));
assertFalse(group.isSummarizedAnimated()); assertFalse(group.isSummarizedAnimated());
assertEquals(100, group.getItem(item.id).progressRateInPercent); 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