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_orientation_event_pump.h" | 5 #include "device_orientation_event_pump.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 MockDeviceOrientationListener* listener() { return listener_.get(); } | 109 MockDeviceOrientationListener* listener() { return listener_.get(); } |
110 DeviceOrientationEventPumpForTesting* orientation_pump() { | 110 DeviceOrientationEventPumpForTesting* orientation_pump() { |
111 return orientation_pump_.get(); | 111 return orientation_pump_.get(); |
112 } | 112 } |
113 base::SharedMemoryHandle handle() { return handle_; } | 113 base::SharedMemoryHandle handle() { return handle_; } |
114 DeviceOrientationHardwareBuffer* buffer() { return buffer_; } | 114 DeviceOrientationHardwareBuffer* buffer() { return buffer_; } |
115 | 115 |
116 private: | 116 private: |
117 scoped_ptr<MockDeviceOrientationListener> listener_; | 117 std::unique_ptr<MockDeviceOrientationListener> listener_; |
118 scoped_ptr<DeviceOrientationEventPumpForTesting> orientation_pump_; | 118 std::unique_ptr<DeviceOrientationEventPumpForTesting> orientation_pump_; |
119 base::SharedMemoryHandle handle_; | 119 base::SharedMemoryHandle handle_; |
120 base::SharedMemory shared_memory_; | 120 base::SharedMemory shared_memory_; |
121 DeviceOrientationHardwareBuffer* buffer_; | 121 DeviceOrientationHardwareBuffer* buffer_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(DeviceOrientationEventPumpTest); | 123 DISALLOW_COPY_AND_ASSIGN(DeviceOrientationEventPumpTest); |
124 }; | 124 }; |
125 | 125 |
126 TEST_F(DeviceOrientationEventPumpTest, DidStartPolling) { | 126 TEST_F(DeviceOrientationEventPumpTest, DidStartPolling) { |
127 base::MessageLoop loop; | 127 base::MessageLoop loop; |
128 | 128 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 FROM_HERE, base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent, | 211 FROM_HERE, base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent, |
212 base::Unretained(orientation_pump()))); | 212 base::Unretained(orientation_pump()))); |
213 base::MessageLoop::current()->Run(); | 213 base::MessageLoop::current()->Run(); |
214 | 214 |
215 EXPECT_TRUE(listener()->did_change_device_orientation()); | 215 EXPECT_TRUE(listener()->did_change_device_orientation()); |
216 EXPECT_EQ(1 + DeviceOrientationEventPump::kOrientationThreshold, | 216 EXPECT_EQ(1 + DeviceOrientationEventPump::kOrientationThreshold, |
217 static_cast<double>(received_data.alpha)); | 217 static_cast<double>(received_data.alpha)); |
218 } | 218 } |
219 | 219 |
220 } // namespace content | 220 } // namespace content |
OLD | NEW |