Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: ash/common/system/chromeos/power/power_status_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/power/power_status.h" 5 #include "ash/common/system/chromeos/power/power_status.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/test/material_design_controller_test_api.h" 10 #include "ash/test/material_design_controller_test_api.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_EQ(1, test_observer_->power_changed_count()); 91 EXPECT_EQ(1, test_observer_->power_changed_count());
92 92
93 // Test RequestUpdate, test_obsever_ should be notified for power suuply 93 // Test RequestUpdate, test_obsever_ should be notified for power suuply
94 // status change. 94 // status change.
95 power_status_->RequestStatusUpdate(); 95 power_status_->RequestStatusUpdate();
96 message_loop_.RunUntilIdle(); 96 message_loop_.RunUntilIdle();
97 EXPECT_EQ(2, test_observer_->power_changed_count()); 97 EXPECT_EQ(2, test_observer_->power_changed_count());
98 } 98 }
99 99
100 TEST_P(PowerStatusTest, ShouldDisplayBatteryTime) { 100 TEST_P(PowerStatusTest, ShouldDisplayBatteryTime) {
101 EXPECT_FALSE(PowerStatus::ShouldDisplayBatteryTime( 101 EXPECT_FALSE(
102 base::TimeDelta::FromSeconds(-1))); 102 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(-1)));
103 EXPECT_FALSE(PowerStatus::ShouldDisplayBatteryTime( 103 EXPECT_FALSE(
104 base::TimeDelta::FromSeconds(0))); 104 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(0)));
105 EXPECT_FALSE(PowerStatus::ShouldDisplayBatteryTime( 105 EXPECT_FALSE(
106 base::TimeDelta::FromSeconds(59))); 106 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(59)));
107 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime( 107 EXPECT_TRUE(
108 base::TimeDelta::FromSeconds(60))); 108 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(60)));
109 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime( 109 EXPECT_TRUE(
110 base::TimeDelta::FromSeconds(600))); 110 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(600)));
111 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime( 111 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime(
112 base::TimeDelta::FromSeconds(3600))); 112 base::TimeDelta::FromSeconds(3600)));
113 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime( 113 EXPECT_TRUE(PowerStatus::ShouldDisplayBatteryTime(
114 base::TimeDelta::FromSeconds( 114 base::TimeDelta::FromSeconds(PowerStatus::kMaxBatteryTimeToDisplaySec)));
115 PowerStatus::kMaxBatteryTimeToDisplaySec))); 115 EXPECT_FALSE(
116 EXPECT_FALSE(PowerStatus::ShouldDisplayBatteryTime( 116 PowerStatus::ShouldDisplayBatteryTime(base::TimeDelta::FromSeconds(
117 base::TimeDelta::FromSeconds(
118 PowerStatus::kMaxBatteryTimeToDisplaySec + 1))); 117 PowerStatus::kMaxBatteryTimeToDisplaySec + 1)));
119 } 118 }
120 119
121 TEST_P(PowerStatusTest, SplitTimeIntoHoursAndMinutes) { 120 TEST_P(PowerStatusTest, SplitTimeIntoHoursAndMinutes) {
122 int hours = 0, minutes = 0; 121 int hours = 0, minutes = 0;
123 PowerStatus::SplitTimeIntoHoursAndMinutes( 122 PowerStatus::SplitTimeIntoHoursAndMinutes(base::TimeDelta::FromSeconds(0),
124 base::TimeDelta::FromSeconds(0), &hours, &minutes); 123 &hours, &minutes);
125 EXPECT_EQ(0, hours); 124 EXPECT_EQ(0, hours);
126 EXPECT_EQ(0, minutes); 125 EXPECT_EQ(0, minutes);
127 126
128 PowerStatus::SplitTimeIntoHoursAndMinutes( 127 PowerStatus::SplitTimeIntoHoursAndMinutes(base::TimeDelta::FromSeconds(60),
129 base::TimeDelta::FromSeconds(60), &hours, &minutes); 128 &hours, &minutes);
130 EXPECT_EQ(0, hours); 129 EXPECT_EQ(0, hours);
131 EXPECT_EQ(1, minutes); 130 EXPECT_EQ(1, minutes);
132 131
133 PowerStatus::SplitTimeIntoHoursAndMinutes( 132 PowerStatus::SplitTimeIntoHoursAndMinutes(base::TimeDelta::FromSeconds(3600),
134 base::TimeDelta::FromSeconds(3600), &hours, &minutes); 133 &hours, &minutes);
135 EXPECT_EQ(1, hours); 134 EXPECT_EQ(1, hours);
136 EXPECT_EQ(0, minutes); 135 EXPECT_EQ(0, minutes);
137 136
138 PowerStatus::SplitTimeIntoHoursAndMinutes( 137 PowerStatus::SplitTimeIntoHoursAndMinutes(
139 base::TimeDelta::FromSeconds(3600 + 60), &hours, &minutes); 138 base::TimeDelta::FromSeconds(3600 + 60), &hours, &minutes);
140 EXPECT_EQ(1, hours); 139 EXPECT_EQ(1, hours);
141 EXPECT_EQ(1, minutes); 140 EXPECT_EQ(1, minutes);
142 141
143 PowerStatus::SplitTimeIntoHoursAndMinutes( 142 PowerStatus::SplitTimeIntoHoursAndMinutes(
144 base::TimeDelta::FromSeconds(7 * 3600 + 23 * 60), &hours, &minutes); 143 base::TimeDelta::FromSeconds(7 * 3600 + 23 * 60), &hours, &minutes);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 11, 345 11,
347 power_status_->GetBatteryImageInfo(PowerStatus::ICON_LIGHT).charge_level); 346 power_status_->GetBatteryImageInfo(PowerStatus::ICON_LIGHT).charge_level);
348 prop.set_battery_percent(100.0); 347 prop.set_battery_percent(100.0);
349 power_status_->SetProtoForTesting(prop); 348 power_status_->SetProtoForTesting(prop);
350 EXPECT_EQ( 349 EXPECT_EQ(
351 12, 350 12,
352 power_status_->GetBatteryImageInfo(PowerStatus::ICON_LIGHT).charge_level); 351 power_status_->GetBatteryImageInfo(PowerStatus::ICON_LIGHT).charge_level);
353 } 352 }
354 353
355 } // namespace ash 354 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/power/power_status.cc ('k') | ash/common/system/chromeos/power/power_status_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698