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

Side by Side 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, 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/chromeos/power/power_status.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/chromeos/power/power_status.h" 5 #include "ash/system/chromeos/power/power_status.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Check that minutes are rounded. 131 // Check that minutes are rounded.
132 PowerStatus::SplitTimeIntoHoursAndMinutes( 132 PowerStatus::SplitTimeIntoHoursAndMinutes(
133 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 30), &hours, &minutes); 133 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 30), &hours, &minutes);
134 EXPECT_EQ(2, hours); 134 EXPECT_EQ(2, hours);
135 EXPECT_EQ(4, minutes); 135 EXPECT_EQ(4, minutes);
136 136
137 PowerStatus::SplitTimeIntoHoursAndMinutes( 137 PowerStatus::SplitTimeIntoHoursAndMinutes(
138 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 29), &hours, &minutes); 138 base::TimeDelta::FromSeconds(2 * 3600 + 3 * 60 + 29), &hours, &minutes);
139 EXPECT_EQ(2, hours); 139 EXPECT_EQ(2, hours);
140 EXPECT_EQ(3, minutes); 140 EXPECT_EQ(3, minutes);
141
142 // Check that times close to hour boundaries aren't incorrectly rounded such
143 // that they display 60 minutes: http://crbug.com/368261
144 PowerStatus::SplitTimeIntoHoursAndMinutes(
145 base::TimeDelta::FromSecondsD(3599.9), &hours, &minutes);
146 EXPECT_EQ(1, hours);
147 EXPECT_EQ(0, minutes);
148
149 PowerStatus::SplitTimeIntoHoursAndMinutes(
150 base::TimeDelta::FromSecondsD(3600.1), &hours, &minutes);
151 EXPECT_EQ(1, hours);
152 EXPECT_EQ(0, minutes);
141 } 153 }
142 154
143 } // namespace ash 155 } // namespace ash
OLDNEW
« 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