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/common/system/chromeos/power/tray_power.h" | 5 #include "ash/common/system/chromeos/power/tray_power.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 PowerStatus::Get()->SetProtoForTesting(proto); | 113 PowerStatus::Get()->SetProtoForTesting(proto); |
114 tray_power_->OnPowerStatusChanged(); | 114 tray_power_->OnPowerStatusChanged(); |
115 EXPECT_EQ(expected_state, notification_state()); | 115 EXPECT_EQ(expected_state, notification_state()); |
116 EXPECT_EQ(expected_add, message_center_->add_count() == prev_add + 1); | 116 EXPECT_EQ(expected_add, message_center_->add_count() == prev_add + 1); |
117 EXPECT_EQ(expected_remove, | 117 EXPECT_EQ(expected_remove, |
118 message_center_->remove_count() == prev_remove + 1); | 118 message_center_->remove_count() == prev_remove + 1); |
119 } | 119 } |
120 | 120 |
121 void SetUsbChargerConnected(bool connected) { | 121 void SetUsbChargerConnected(bool connected) { |
122 tray_power_->usb_charger_was_connected_ = connected; | 122 tray_power_->usb_charger_was_connected_ = connected; |
123 } | 123 } |
124 | 124 |
125 // Returns a discharging PowerSupplyProperties more appropriate for testing. | 125 // Returns a discharging PowerSupplyProperties more appropriate for testing. |
126 static PowerSupplyProperties DefaultPowerSupplyProperties() { | 126 static PowerSupplyProperties DefaultPowerSupplyProperties() { |
127 PowerSupplyProperties proto; | 127 PowerSupplyProperties proto; |
128 proto.set_external_power( | 128 proto.set_external_power( |
129 power_manager::PowerSupplyProperties_ExternalPower_DISCONNECTED); | 129 power_manager::PowerSupplyProperties_ExternalPower_DISCONNECTED); |
130 proto.set_battery_state( | 130 proto.set_battery_state( |
131 power_manager::PowerSupplyProperties_BatteryState_DISCHARGING); | 131 power_manager::PowerSupplyProperties_BatteryState_DISCHARGING); |
132 proto.set_battery_percent(50.0); | 132 proto.set_battery_percent(50.0); |
133 proto.set_battery_time_to_empty_sec(3 * 60 * 60); | 133 proto.set_battery_time_to_empty_sec(3 * 60 * 60); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 power_manager::PowerSupplyProperties_ExternalPower_USB); | 426 power_manager::PowerSupplyProperties_ExternalPower_USB); |
427 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1); | 427 safe_usb.set_battery_percent(TrayPower::kNoWarningPercentage - 0.1); |
428 { | 428 { |
429 SCOPED_TRACE("Notification removed for rounded percent above threshold"); | 429 SCOPED_TRACE("Notification removed for rounded percent above threshold"); |
430 UpdateNotificationState(safe_usb, TrayPower::NOTIFICATION_NONE, false, | 430 UpdateNotificationState(safe_usb, TrayPower::NOTIFICATION_NONE, false, |
431 true); | 431 true); |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 } // namespace ash | 435 } // namespace ash |
OLD | NEW |