| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/battery/battery_status_manager_linux.h" | 5 #include "device/battery/battery_status_manager_linux.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 writer->AppendVariantOfUint32(properties->type); | 318 writer->AppendVariantOfUint32(properties->type); |
| 319 else | 319 else |
| 320 LOG(WARNING) << __FUNCTION__ << " unknown property: " << property_name; | 320 LOG(WARNING) << __FUNCTION__ << " unknown property: " << property_name; |
| 321 } | 321 } |
| 322 | 322 |
| 323 void MockBatteryObject::AppendAllPropertiesToWriter( | 323 void MockBatteryObject::AppendAllPropertiesToWriter( |
| 324 dbus::MessageWriter* writer) { | 324 dbus::MessageWriter* writer) { |
| 325 dbus::MessageWriter array_writer(nullptr); | 325 dbus::MessageWriter array_writer(nullptr); |
| 326 dbus::MessageWriter dict_entry_writer(nullptr); | 326 dbus::MessageWriter dict_entry_writer(nullptr); |
| 327 writer->OpenArray("{sv}", &array_writer); | 327 writer->OpenArray("{sv}", &array_writer); |
| 328 for (auto property_name : | 328 for (auto* property_name : |
| 329 {kUPowerDevicePropertyIsPresent, kUPowerDevicePropertyState, | 329 {kUPowerDevicePropertyIsPresent, kUPowerDevicePropertyState, |
| 330 kUPowerDevicePropertyTimeToEmpty, kUPowerDevicePropertyTimeToFull, | 330 kUPowerDevicePropertyTimeToEmpty, kUPowerDevicePropertyTimeToFull, |
| 331 kUPowerDevicePropertyType}) { | 331 kUPowerDevicePropertyType}) { |
| 332 array_writer.OpenDictEntry(&dict_entry_writer); | 332 array_writer.OpenDictEntry(&dict_entry_writer); |
| 333 dict_entry_writer.AppendString(property_name); | 333 dict_entry_writer.AppendString(property_name); |
| 334 AppendPropertyToWriter(&dict_entry_writer, property_name); | 334 AppendPropertyToWriter(&dict_entry_writer, property_name); |
| 335 array_writer.CloseContainer(&dict_entry_writer); | 335 array_writer.CloseContainer(&dict_entry_writer); |
| 336 } | 336 } |
| 337 writer->CloseContainer(&array_writer); | 337 writer->CloseContainer(&array_writer); |
| 338 } | 338 } |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 status = last_battery_status(); | 1212 status = last_battery_status(); |
| 1213 EXPECT_EQ(last_count, count_battery_updates()); | 1213 EXPECT_EQ(last_count, count_battery_updates()); |
| 1214 | 1214 |
| 1215 EXPECT_FALSE(status.charging); | 1215 EXPECT_FALSE(status.charging); |
| 1216 EXPECT_EQ(std::numeric_limits<double>::infinity(), status.charging_time); | 1216 EXPECT_EQ(std::numeric_limits<double>::infinity(), status.charging_time); |
| 1217 EXPECT_EQ(200, status.discharging_time); | 1217 EXPECT_EQ(200, status.discharging_time); |
| 1218 EXPECT_EQ(0.7, status.level); | 1218 EXPECT_EQ(0.7, status.level); |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 } // namespace device | 1221 } // namespace device |
| OLD | NEW |