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_light_event_pump.h" | 5 #include "device_light_event_pump.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 DeviceLightData& data = buffer_->data; | 83 DeviceLightData& data = buffer_->data; |
84 data.value = 1.0; | 84 data.value = 1.0; |
85 } | 85 } |
86 | 86 |
87 MockDeviceLightListener* listener() { return listener_.get(); } | 87 MockDeviceLightListener* listener() { return listener_.get(); } |
88 DeviceLightEventPumpForTesting* light_pump() { return light_pump_.get(); } | 88 DeviceLightEventPumpForTesting* light_pump() { return light_pump_.get(); } |
89 base::SharedMemoryHandle handle() { return handle_; } | 89 base::SharedMemoryHandle handle() { return handle_; } |
90 DeviceLightHardwareBuffer* buffer() { return buffer_; } | 90 DeviceLightHardwareBuffer* buffer() { return buffer_; } |
91 | 91 |
92 private: | 92 private: |
93 scoped_ptr<MockDeviceLightListener> listener_; | 93 std::unique_ptr<MockDeviceLightListener> listener_; |
94 scoped_ptr<DeviceLightEventPumpForTesting> light_pump_; | 94 std::unique_ptr<DeviceLightEventPumpForTesting> light_pump_; |
95 base::SharedMemoryHandle handle_; | 95 base::SharedMemoryHandle handle_; |
96 base::SharedMemory shared_memory_; | 96 base::SharedMemory shared_memory_; |
97 DeviceLightHardwareBuffer* buffer_; | 97 DeviceLightHardwareBuffer* buffer_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(DeviceLightEventPumpTest); | 99 DISALLOW_COPY_AND_ASSIGN(DeviceLightEventPumpTest); |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(DeviceLightEventPumpTest, DidStartPolling) { | 102 TEST_F(DeviceLightEventPumpTest, DidStartPolling) { |
103 base::MessageLoopForUI loop; | 103 base::MessageLoopForUI loop; |
104 | 104 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, | 153 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, |
154 base::Unretained(light_pump()))); | 154 base::Unretained(light_pump()))); |
155 base::MessageLoop::current()->Run(); | 155 base::MessageLoop::current()->Run(); |
156 | 156 |
157 // No change in device light as present value is same as previous value. | 157 // No change in device light as present value is same as previous value. |
158 EXPECT_FALSE(listener()->did_change_device_light()); | 158 EXPECT_FALSE(listener()->did_change_device_light()); |
159 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); | 159 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); |
160 } | 160 } |
161 | 161 |
162 } // namespace content | 162 } // namespace content |
OLD | NEW |