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

Unified Diff: ash/system/chromeos/power/power_status_unittest.cc

Issue 258303002: chromeos: Fix a bug in the battery-time-rounding code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/chromeos/power/power_status.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/power/power_status_unittest.cc
diff --git a/ash/system/chromeos/power/power_status_unittest.cc b/ash/system/chromeos/power/power_status_unittest.cc
index cf1da4b06cf6275f183ac07267b59009e38a8f52..f983f26130f04c053afb6daa9640af087e2b73ad 100644
--- a/ash/system/chromeos/power/power_status_unittest.cc
+++ b/ash/system/chromeos/power/power_status_unittest.cc
@@ -138,6 +138,18 @@ TEST_F(PowerStatusTest, SplitTimeIntoHoursAndMinutes) {
base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 29), &hours, &minutes);
EXPECT_EQ(2, hours);
EXPECT_EQ(3, minutes);
+
+ // Check that times close to hour boundaries aren't incorrectly rounded such
+ // that they display 60 minutes: http://crbug.com/368261
+ PowerStatus::SplitTimeIntoHoursAndMinutes(
+ base::TimeDelta::FromSecondsD(3599.9), &hours, &minutes);
+ EXPECT_EQ(1, hours);
+ EXPECT_EQ(0, minutes);
+
+ PowerStatus::SplitTimeIntoHoursAndMinutes(
+ base::TimeDelta::FromSecondsD(3600.1), &hours, &minutes);
+ EXPECT_EQ(1, hours);
+ EXPECT_EQ(0, minutes);
}
} // namespace ash
« no previous file with comments | « ash/system/chromeos/power/power_status.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698