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

Side by Side Diff: ash/system/chromeos/power/tray_power_unittest.cc

Issue 148463011: Merge 247397 "chromeos: Avoid notification for original Spring c..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 6 years, 10 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/tray_power.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/tray_power.h" 5 #include "ash/system/chromeos/power/tray_power.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" 10 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 critical_usb.set_battery_percent(TrayPower::kCriticalPercentage + 0.2); 211 critical_usb.set_battery_percent(TrayPower::kCriticalPercentage + 0.2);
212 EXPECT_TRUE(UpdateNotificationState(critical_usb)); 212 EXPECT_TRUE(UpdateNotificationState(critical_usb));
213 EXPECT_EQ(TrayPower::NOTIFICATION_CRITICAL, notification_state()); 213 EXPECT_EQ(TrayPower::NOTIFICATION_CRITICAL, notification_state());
214 214
215 PowerSupplyProperties safe_usb = DefaultPowerSupplyProperties(); 215 PowerSupplyProperties safe_usb = DefaultPowerSupplyProperties();
216 safe_usb.set_external_power( 216 safe_usb.set_external_power(
217 power_manager::PowerSupplyProperties_ExternalPower_USB); 217 power_manager::PowerSupplyProperties_ExternalPower_USB);
218 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1); 218 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1);
219 EXPECT_FALSE(UpdateNotificationState(safe_usb)); 219 EXPECT_FALSE(UpdateNotificationState(safe_usb));
220 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state()); 220 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state());
221
222 // A notification shouldn't be shown when we're in the full state with an
223 // original Spring charger connected: http://crbug.com/338376
224 PowerSupplyProperties spring = DefaultPowerSupplyProperties();
225 spring.set_external_power(power_manager::
226 PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER);
227 spring.set_battery_state(
228 power_manager::PowerSupplyProperties_BatteryState_FULL);
229 spring.set_battery_time_to_empty_sec(0);
230 spring.set_battery_time_to_full_sec(0);
231 EXPECT_FALSE(UpdateNotificationState(spring));
232 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state());
221 } 233 }
222 234
223 } // namespace internal 235 } // namespace internal
224 } // namespace ash 236 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/power/tray_power.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698