| 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 "services/device/power_monitor/power_monitor_message_broadcaster.h" |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 8 #include "base/test/power_monitor_test_base.h" | 10 #include "base/test/power_monitor_test_base.h" |
| 9 #include "device/power_monitor/power_monitor_message_broadcaster.h" | |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace device { | 14 namespace device { |
| 14 | 15 |
| 15 class FakePowerMonitorClient : public device::mojom::PowerMonitorClient { | 16 class FakePowerMonitorClient : public device::mojom::PowerMonitorClient { |
| 16 public: | 17 public: |
| 17 FakePowerMonitorClient(device::mojom::PowerMonitorClientRequest request) | 18 FakePowerMonitorClient(device::mojom::PowerMonitorClientRequest request) |
| 18 : binding_(this, std::move(request)), | 19 : binding_(this, std::move(request)), |
| 19 power_state_changes_(0), | 20 power_state_changes_(0), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Pretend the device has gone off battery power | 103 // Pretend the device has gone off battery power |
| 103 source()->GeneratePowerStateEvent(false); | 104 source()->GeneratePowerStateEvent(false); |
| 104 EXPECT_EQ(client.power_state_changes(), 3); | 105 EXPECT_EQ(client.power_state_changes(), 3); |
| 105 | 106 |
| 106 // Repeated indications the device is off battery power should be suppressed. | 107 // Repeated indications the device is off battery power should be suppressed. |
| 107 source()->GeneratePowerStateEvent(false); | 108 source()->GeneratePowerStateEvent(false); |
| 108 EXPECT_EQ(client.power_state_changes(), 3); | 109 EXPECT_EQ(client.power_state_changes(), 3); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace device | 112 } // namespace device |
| OLD | NEW |