OLD | NEW |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 critical_usb.set_battery_percent(TrayPower::kCriticalPercentage + 0.2); | 210 critical_usb.set_battery_percent(TrayPower::kCriticalPercentage + 0.2); |
211 EXPECT_TRUE(UpdateNotificationState(critical_usb)); | 211 EXPECT_TRUE(UpdateNotificationState(critical_usb)); |
212 EXPECT_EQ(TrayPower::NOTIFICATION_CRITICAL, notification_state()); | 212 EXPECT_EQ(TrayPower::NOTIFICATION_CRITICAL, notification_state()); |
213 | 213 |
214 PowerSupplyProperties safe_usb = DefaultPowerSupplyProperties(); | 214 PowerSupplyProperties safe_usb = DefaultPowerSupplyProperties(); |
215 safe_usb.set_external_power( | 215 safe_usb.set_external_power( |
216 power_manager::PowerSupplyProperties_ExternalPower_USB); | 216 power_manager::PowerSupplyProperties_ExternalPower_USB); |
217 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1); | 217 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1); |
218 EXPECT_FALSE(UpdateNotificationState(safe_usb)); | 218 EXPECT_FALSE(UpdateNotificationState(safe_usb)); |
219 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state()); | 219 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state()); |
220 | |
221 // A notification shouldn't be shown when we're in the full state with an | |
222 // original Spring charger connected: http://crbug.com/338376 | |
223 PowerSupplyProperties spring = DefaultPowerSupplyProperties(); | |
224 spring.set_external_power(power_manager:: | |
225 PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER); | |
226 spring.set_battery_state( | |
227 power_manager::PowerSupplyProperties_BatteryState_FULL); | |
228 spring.set_battery_time_to_empty_sec(0); | |
229 spring.set_battery_time_to_full_sec(0); | |
230 EXPECT_FALSE(UpdateNotificationState(spring)); | |
231 EXPECT_EQ(TrayPower::NOTIFICATION_NONE, notification_state()); | |
232 } | 220 } |
233 | 221 |
234 } // namespace ash | 222 } // namespace ash |
OLD | NEW |