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

Side by Side Diff: content/renderer/device_sensors/device_motion_event_pump_unittest.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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 "content/renderer/device_sensors/device_motion_event_pump.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory>
10
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
15 #include "content/common/device_sensors/device_motion_hardware_buffer.h" 16 #include "content/common/device_sensors/device_motion_hardware_buffer.h"
16 #include "content/public/test/test_utils.h" 17 #include "content/public/test/test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h" 19 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 class MockDeviceMotionListener : public blink::WebDeviceMotionListener { 23 class MockDeviceMotionListener : public blink::WebDeviceMotionListener {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 data.accelerationZ = 3; 113 data.accelerationZ = 3;
113 data.hasAccelerationZ = true; 114 data.hasAccelerationZ = true;
114 data.allAvailableSensorsAreActive = allAvailableSensorsActive; 115 data.allAvailableSensorsAreActive = allAvailableSensorsActive;
115 } 116 }
116 117
117 MockDeviceMotionListener* listener() { return listener_.get(); } 118 MockDeviceMotionListener* listener() { return listener_.get(); }
118 DeviceMotionEventPumpForTesting* motion_pump() { return motion_pump_.get(); } 119 DeviceMotionEventPumpForTesting* motion_pump() { return motion_pump_.get(); }
119 base::SharedMemoryHandle handle() { return handle_; } 120 base::SharedMemoryHandle handle() { return handle_; }
120 121
121 private: 122 private:
122 scoped_ptr<MockDeviceMotionListener> listener_; 123 std::unique_ptr<MockDeviceMotionListener> listener_;
123 scoped_ptr<DeviceMotionEventPumpForTesting> motion_pump_; 124 std::unique_ptr<DeviceMotionEventPumpForTesting> motion_pump_;
124 base::SharedMemoryHandle handle_; 125 base::SharedMemoryHandle handle_;
125 base::SharedMemory shared_memory_; 126 base::SharedMemory shared_memory_;
126 DeviceMotionHardwareBuffer* buffer_; 127 DeviceMotionHardwareBuffer* buffer_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpTest); 129 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpTest);
129 }; 130 };
130 131
131 TEST_F(DeviceMotionEventPumpTest, DidStartPolling) { 132 TEST_F(DeviceMotionEventPumpTest, DidStartPolling) {
132 base::MessageLoopForUI loop; 133 base::MessageLoopForUI loop;
133 134
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::MessageLoop::current()->Run(); 202 base::MessageLoop::current()->Run();
202 motion_pump()->Stop(); 203 motion_pump()->Stop();
203 204
204 // Check that the blink::WebDeviceMotionListener does not receive excess 205 // Check that the blink::WebDeviceMotionListener does not receive excess
205 // events. 206 // events.
206 EXPECT_TRUE(listener()->did_change_device_motion()); 207 EXPECT_TRUE(listener()->did_change_device_motion());
207 EXPECT_GE(6, listener()->number_of_events()); 208 EXPECT_GE(6, listener()->number_of_events());
208 } 209 }
209 210
210 } // namespace content 211 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698