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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |