Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: device/power_monitor/power_monitor_message_broadcaster_unittest.cc

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/test/power_monitor_test_base.h" 8 #include "base/test/power_monitor_test_base.h"
9 #include "device/power_monitor/power_monitor_message_broadcaster.h" 9 #include "device/power_monitor/power_monitor_message_broadcaster.h"
10 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 private: 55 private:
56 base::MessageLoop message_loop_; 56 base::MessageLoop message_loop_;
57 base::PowerMonitorTestSource* power_monitor_source_; 57 base::PowerMonitorTestSource* power_monitor_source_;
58 std::unique_ptr<base::PowerMonitor> power_monitor_; 58 std::unique_ptr<base::PowerMonitor> power_monitor_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcasterTest); 60 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcasterTest);
61 }; 61 };
62 62
63 TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) { 63 TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) {
64 device::mojom::PowerMonitorClientPtr proxy; 64 device::mojom::PowerMonitorClientPtr proxy;
65 FakePowerMonitorClient client(mojo::GetProxy(&proxy)); 65 FakePowerMonitorClient client(mojo::MakeRequest(&proxy));
66 PowerMonitorMessageBroadcaster broadcaster; 66 PowerMonitorMessageBroadcaster broadcaster;
67 67
68 // Calling SetClient should invoke a power state change. 68 // Calling SetClient should invoke a power state change.
69 broadcaster.SetClient(std::move(proxy)); 69 broadcaster.SetClient(std::move(proxy));
70 70
71 base::RunLoop().RunUntilIdle(); 71 base::RunLoop().RunUntilIdle();
72 EXPECT_EQ(client.power_state_changes(), 1); 72 EXPECT_EQ(client.power_state_changes(), 1);
73 73
74 // Sending resume when not suspended should have no effect. 74 // Sending resume when not suspended should have no effect.
75 source()->GenerateResumeEvent(); 75 source()->GenerateResumeEvent();
(...skipping 26 matching lines...) Expand all
102 // Pretend the device has gone off battery power 102 // Pretend the device has gone off battery power
103 source()->GeneratePowerStateEvent(false); 103 source()->GeneratePowerStateEvent(false);
104 EXPECT_EQ(client.power_state_changes(), 3); 104 EXPECT_EQ(client.power_state_changes(), 3);
105 105
106 // Repeated indications the device is off battery power should be suppressed. 106 // Repeated indications the device is off battery power should be suppressed.
107 source()->GeneratePowerStateEvent(false); 107 source()->GeneratePowerStateEvent(false);
108 EXPECT_EQ(client.power_state_changes(), 3); 108 EXPECT_EQ(client.power_state_changes(), 3);
109 } 109 }
110 110
111 } // namespace device 111 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/sensor_impl.cc ('k') | device/power_monitor/public/cpp/power_monitor_broadcast_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698