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_motion_event_pump.h" | 5 #include "device_motion_event_pump.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 bool did_change_device_motion_; | 38 bool did_change_device_motion_; |
39 blink::WebDeviceMotionData data_; | 39 blink::WebDeviceMotionData data_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(MockDeviceMotionListener); | 41 DISALLOW_COPY_AND_ASSIGN(MockDeviceMotionListener); |
42 }; | 42 }; |
43 | 43 |
44 class DeviceMotionEventPumpForTesting : public DeviceMotionEventPump { | 44 class DeviceMotionEventPumpForTesting : public DeviceMotionEventPump { |
45 public: | 45 public: |
46 DeviceMotionEventPumpForTesting() | 46 DeviceMotionEventPumpForTesting() |
47 : DeviceMotionEventPump(0) { } | 47 : DeviceMotionEventPump(0) { } |
48 virtual ~DeviceMotionEventPumpForTesting() { } | 48 ~DeviceMotionEventPumpForTesting() override {} |
49 | 49 |
50 void OnDidStart(base::SharedMemoryHandle renderer_handle) { | 50 void OnDidStart(base::SharedMemoryHandle renderer_handle) { |
51 DeviceMotionEventPump::OnDidStart(renderer_handle); | 51 DeviceMotionEventPump::OnDidStart(renderer_handle); |
52 } | 52 } |
53 virtual void SendStartMessage() override { } | 53 void SendStartMessage() override {} |
54 virtual void SendStopMessage() override { } | 54 void SendStopMessage() override {} |
55 virtual void FireEvent() override { | 55 void FireEvent() override { |
56 DeviceMotionEventPump::FireEvent(); | 56 DeviceMotionEventPump::FireEvent(); |
57 Stop(); | 57 Stop(); |
58 base::MessageLoop::current()->QuitWhenIdle(); | 58 base::MessageLoop::current()->QuitWhenIdle(); |
59 } | 59 } |
60 | 60 |
61 private: | 61 private: |
62 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpForTesting); | 62 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpForTesting); |
63 }; | 63 }; |
64 | 64 |
65 class DeviceMotionEventPumpTest : public testing::Test { | 65 class DeviceMotionEventPumpTest : public testing::Test { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 EXPECT_FALSE(received_data.hasAccelerationZ); | 152 EXPECT_FALSE(received_data.hasAccelerationZ); |
153 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityX); | 153 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityX); |
154 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityY); | 154 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityY); |
155 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityZ); | 155 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityZ); |
156 EXPECT_FALSE(received_data.hasRotationRateAlpha); | 156 EXPECT_FALSE(received_data.hasRotationRateAlpha); |
157 EXPECT_FALSE(received_data.hasRotationRateBeta); | 157 EXPECT_FALSE(received_data.hasRotationRateBeta); |
158 EXPECT_FALSE(received_data.hasRotationRateGamma); | 158 EXPECT_FALSE(received_data.hasRotationRateGamma); |
159 } | 159 } |
160 | 160 |
161 } // namespace content | 161 } // namespace content |
OLD | NEW |