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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | |
10 #include "content/public/test/test_utils.h" | 9 #include "content/public/test/test_utils.h" |
| 10 #include "device/device_sensors/device_orientation_hardware_buffer.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" | 12 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class MockDeviceOrientationListener | 16 class MockDeviceOrientationListener |
17 : public blink::WebDeviceOrientationListener { | 17 : public blink::WebDeviceOrientationListener { |
18 public: | 18 public: |
19 MockDeviceOrientationListener() : did_change_device_orientation_(false) { | 19 MockDeviceOrientationListener() : did_change_device_orientation_(false) { |
20 memset(&data_, 0, sizeof(data_)); | 20 memset(&data_, 0, sizeof(data_)); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent, | 206 base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent, |
207 base::Unretained(orientation_pump()))); | 207 base::Unretained(orientation_pump()))); |
208 base::MessageLoop::current()->Run(); | 208 base::MessageLoop::current()->Run(); |
209 | 209 |
210 EXPECT_TRUE(listener()->did_change_device_orientation()); | 210 EXPECT_TRUE(listener()->did_change_device_orientation()); |
211 EXPECT_EQ(1 + DeviceOrientationEventPump::kOrientationThreshold, | 211 EXPECT_EQ(1 + DeviceOrientationEventPump::kOrientationThreshold, |
212 static_cast<double>(received_data.alpha)); | 212 static_cast<double>(received_data.alpha)); |
213 } | 213 } |
214 | 214 |
215 } // namespace content | 215 } // namespace content |
OLD | NEW |