Commit 9d5a10f1 authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Use the powerd-provided value for low-power adapter notifications.

BUG=b:160854398

Change-Id: Ie75213a865d608835f93506c7f2b21c264880bde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417670Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810466}
parent 6fd9af2e
......@@ -271,6 +271,7 @@ TEST_F(PowerNotificationControllerTest,
power_manager::PowerSupplyProperties_ExternalPower_AC);
ac_connected.set_battery_state(
power_manager::PowerSupplyProperties_BatteryState_NOT_PRESENT);
ac_connected.set_preferred_minimum_external_power(60.0);
EXPECT_FALSE(MaybeShowUsbChargerNotification(ac_connected));
EXPECT_EQ(0, message_center()->add_count());
EXPECT_EQ(0, message_center()->remove_count());
......@@ -281,6 +282,7 @@ TEST_F(PowerNotificationControllerTest,
power_manager::PowerSupplyProperties_ExternalPower_USB);
usb_connected.set_battery_state(
power_manager::PowerSupplyProperties_BatteryState_NOT_PRESENT);
usb_connected.set_preferred_minimum_external_power(60.0);
EXPECT_TRUE(MaybeShowUsbChargerNotification(usb_connected));
EXPECT_EQ(1, message_center()->add_count());
EXPECT_EQ(0, message_center()->remove_count());
......
......@@ -486,8 +486,7 @@ base::string16 PowerStatus::GetInlinedStatusString() const {
}
double PowerStatus::GetPreferredMinimumPower() const {
// TODO(b/160854398): Return the value from the proto once it's ready.
return 60.0;
return proto_.preferred_minimum_external_power();
}
PowerStatus::PowerStatus() {
......
......@@ -283,4 +283,14 @@ TEST_F(PowerStatusTest, MissingBatteryTimeEstimates) {
EXPECT_FALSE(time) << *time << " returned despite negative estimate";
}
TEST_F(PowerStatusTest, PreferredMinimumExternalPower) {
PowerSupplyProperties prop;
prop.set_external_power(PowerSupplyProperties::USB);
prop.set_battery_state(PowerSupplyProperties::NOT_PRESENT);
prop.set_preferred_minimum_external_power(23.45);
power_status_->SetProtoForTesting(prop);
EXPECT_EQ(23.45, power_status_->GetPreferredMinimumPower());
}
} // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment