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

Side by Side Diff: content/browser/device_sensors/device_inertial_sensor_browsertest.cc

Issue 633503002: Replacing the OVERRIDE with override and FINAL with final in content/browser/device_sensors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/synchronization/waitable_event.h" 6 #include "base/synchronization/waitable_event.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" 8 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
9 #include "content/browser/device_sensors/device_inertial_sensor_service.h" 9 #include "content/browser/device_sensors/device_inertial_sensor_service.h"
10 #include "content/common/device_sensors/device_light_hardware_buffer.h" 10 #include "content/common/device_sensors/device_light_hardware_buffer.h"
(...skipping 18 matching lines...) Expand all
29 FakeDataFetcher() 29 FakeDataFetcher()
30 : started_orientation_(false, false), 30 : started_orientation_(false, false),
31 stopped_orientation_(false, false), 31 stopped_orientation_(false, false),
32 started_motion_(false, false), 32 started_motion_(false, false),
33 stopped_motion_(false, false), 33 stopped_motion_(false, false),
34 started_light_(false, false), 34 started_light_(false, false),
35 stopped_light_(false, false), 35 stopped_light_(false, false),
36 sensor_data_available_(true) {} 36 sensor_data_available_(true) {}
37 virtual ~FakeDataFetcher() { } 37 virtual ~FakeDataFetcher() { }
38 38
39 virtual bool Start(ConsumerType consumer_type, void* buffer) OVERRIDE { 39 virtual bool Start(ConsumerType consumer_type, void* buffer) override {
40 EXPECT_TRUE(buffer); 40 EXPECT_TRUE(buffer);
41 41
42 switch (consumer_type) { 42 switch (consumer_type) {
43 case CONSUMER_TYPE_MOTION: 43 case CONSUMER_TYPE_MOTION:
44 { 44 {
45 DeviceMotionHardwareBuffer* motion_buffer = 45 DeviceMotionHardwareBuffer* motion_buffer =
46 static_cast<DeviceMotionHardwareBuffer*>(buffer); 46 static_cast<DeviceMotionHardwareBuffer*>(buffer);
47 if (sensor_data_available_) 47 if (sensor_data_available_)
48 UpdateMotion(motion_buffer); 48 UpdateMotion(motion_buffer);
49 SetMotionBufferReady(motion_buffer); 49 SetMotionBufferReady(motion_buffer);
(...skipping 20 matching lines...) Expand all
70 : std::numeric_limits<double>::infinity()); 70 : std::numeric_limits<double>::infinity());
71 started_light_.Signal(); 71 started_light_.Signal();
72 } 72 }
73 break; 73 break;
74 default: 74 default:
75 return false; 75 return false;
76 } 76 }
77 return true; 77 return true;
78 } 78 }
79 79
80 virtual bool Stop(ConsumerType consumer_type) OVERRIDE { 80 virtual bool Stop(ConsumerType consumer_type) override {
81 switch (consumer_type) { 81 switch (consumer_type) {
82 case CONSUMER_TYPE_MOTION: 82 case CONSUMER_TYPE_MOTION:
83 stopped_motion_.Signal(); 83 stopped_motion_.Signal();
84 break; 84 break;
85 case CONSUMER_TYPE_ORIENTATION: 85 case CONSUMER_TYPE_ORIENTATION:
86 stopped_orientation_.Signal(); 86 stopped_orientation_.Signal();
87 break; 87 break;
88 case CONSUMER_TYPE_LIGHT: 88 case CONSUMER_TYPE_LIGHT:
89 stopped_light_.Signal(); 89 stopped_light_.Signal();
90 break; 90 break;
91 default: 91 default:
92 return false; 92 return false;
93 } 93 }
94 return true; 94 return true;
95 } 95 }
96 96
97 virtual void Fetch(unsigned consumer_bitmask) OVERRIDE { 97 virtual void Fetch(unsigned consumer_bitmask) override {
98 FAIL() << "fetch should not be called"; 98 FAIL() << "fetch should not be called";
99 } 99 }
100 100
101 virtual FetcherType GetType() const OVERRIDE { 101 virtual FetcherType GetType() const override {
102 return FETCHER_TYPE_DEFAULT; 102 return FETCHER_TYPE_DEFAULT;
103 } 103 }
104 104
105 void SetSensorDataAvailable(bool available) { 105 void SetSensorDataAvailable(bool available) {
106 sensor_data_available_ = available; 106 sensor_data_available_ = available;
107 } 107 }
108 108
109 void SetMotionBufferReady(DeviceMotionHardwareBuffer* buffer) { 109 void SetMotionBufferReady(DeviceMotionHardwareBuffer* buffer) {
110 buffer->seqlock.WriteBegin(); 110 buffer->seqlock.WriteBegin();
111 buffer->data.allAvailableSensorsAreActive = true; 111 buffer->data.allAvailableSensorsAreActive = true;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 }; 177 };
178 178
179 179
180 class DeviceInertialSensorBrowserTest : public ContentBrowserTest { 180 class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
181 public: 181 public:
182 DeviceInertialSensorBrowserTest() 182 DeviceInertialSensorBrowserTest()
183 : fetcher_(NULL), 183 : fetcher_(NULL),
184 io_loop_finished_event_(false, false) { 184 io_loop_finished_event_(false, false) {
185 } 185 }
186 186
187 virtual void SetUpOnMainThread() OVERRIDE { 187 virtual void SetUpOnMainThread() override {
188 BrowserThread::PostTask( 188 BrowserThread::PostTask(
189 BrowserThread::IO, FROM_HERE, 189 BrowserThread::IO, FROM_HERE,
190 base::Bind(&DeviceInertialSensorBrowserTest::SetUpOnIOThread, this)); 190 base::Bind(&DeviceInertialSensorBrowserTest::SetUpOnIOThread, this));
191 io_loop_finished_event_.Wait(); 191 io_loop_finished_event_.Wait();
192 } 192 }
193 193
194 void SetUpOnIOThread() { 194 void SetUpOnIOThread() {
195 fetcher_ = new FakeDataFetcher(); 195 fetcher_ = new FakeDataFetcher();
196 DeviceInertialSensorService::GetInstance()-> 196 DeviceInertialSensorService::GetInstance()->
197 SetDataFetcherForTesting(fetcher_); 197 SetDataFetcherForTesting(fetcher_);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 fetcher_->started_motion_.Wait(); 352 fetcher_->started_motion_.Wait();
353 fetcher_->stopped_motion_.Wait(); 353 fetcher_->stopped_motion_.Wait();
354 same_tab_observer.Wait(); 354 same_tab_observer.Wait();
355 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); 355 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
356 } 356 }
357 357
358 } // namespace 358 } // namespace
359 359
360 } // namespace content 360 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698