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

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

Issue 2026253003: Migrate WaitableEvent to enum-based constructor in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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/macros.h" 6 #include "base/macros.h"
7 #include "base/synchronization/waitable_event.h" 7 #include "base/synchronization/waitable_event.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" 9 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
10 #include "content/browser/device_sensors/device_inertial_sensor_service.h" 10 #include "content/browser/device_sensors/device_inertial_sensor_service.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/shell/browser/shell.h" 21 #include "content/shell/browser/shell.h"
22 #include "content/shell/browser/shell_javascript_dialog_manager.h" 22 #include "content/shell/browser/shell_javascript_dialog_manager.h"
23 23
24 namespace content { 24 namespace content {
25 25
26 namespace { 26 namespace {
27 27
28 class FakeDataFetcher : public DataFetcherSharedMemory { 28 class FakeDataFetcher : public DataFetcherSharedMemory {
29 public: 29 public:
30 FakeDataFetcher() 30 FakeDataFetcher()
31 : started_orientation_(false, false), 31 : started_orientation_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
32 stopped_orientation_(false, false), 32 base::WaitableEvent::InitialState::NOT_SIGNALED),
33 started_motion_(false, false), 33 stopped_orientation_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
34 stopped_motion_(false, false), 34 base::WaitableEvent::InitialState::NOT_SIGNALED),
35 started_light_(false, false), 35 started_motion_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
36 stopped_light_(false, false), 36 base::WaitableEvent::InitialState::NOT_SIGNALED),
37 stopped_motion_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
38 base::WaitableEvent::InitialState::NOT_SIGNALED),
39 started_light_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
40 base::WaitableEvent::InitialState::NOT_SIGNALED),
41 stopped_light_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
42 base::WaitableEvent::InitialState::NOT_SIGNALED),
37 sensor_data_available_(true) {} 43 sensor_data_available_(true) {}
38 ~FakeDataFetcher() override {} 44 ~FakeDataFetcher() override {}
39 45
40 bool Start(ConsumerType consumer_type, void* buffer) override { 46 bool Start(ConsumerType consumer_type, void* buffer) override {
41 EXPECT_TRUE(buffer); 47 EXPECT_TRUE(buffer);
42 48
43 switch (consumer_type) { 49 switch (consumer_type) {
44 case CONSUMER_TYPE_MOTION: 50 case CONSUMER_TYPE_MOTION:
45 { 51 {
46 DeviceMotionHardwareBuffer* motion_buffer = 52 DeviceMotionHardwareBuffer* motion_buffer =
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool sensor_data_available_; 178 bool sensor_data_available_;
173 179
174 private: 180 private:
175 DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); 181 DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher);
176 }; 182 };
177 183
178 184
179 class DeviceInertialSensorBrowserTest : public ContentBrowserTest { 185 class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
180 public: 186 public:
181 DeviceInertialSensorBrowserTest() 187 DeviceInertialSensorBrowserTest()
182 : fetcher_(nullptr), io_loop_finished_event_(false, false) {} 188 : fetcher_(nullptr),
189 io_loop_finished_event_(
190 base::WaitableEvent::ResetPolicy::AUTOMATIC,
191 base::WaitableEvent::InitialState::NOT_SIGNALED) {}
183 192
184 void SetUpOnMainThread() override { 193 void SetUpOnMainThread() override {
185 BrowserThread::PostTask( 194 BrowserThread::PostTask(
186 BrowserThread::IO, FROM_HERE, 195 BrowserThread::IO, FROM_HERE,
187 base::Bind(&DeviceInertialSensorBrowserTest::SetUpOnIOThread, this)); 196 base::Bind(&DeviceInertialSensorBrowserTest::SetUpOnIOThread, this));
188 io_loop_finished_event_.Wait(); 197 io_loop_finished_event_.Wait();
189 } 198 }
190 199
191 void SetUpOnIOThread() { 200 void SetUpOnIOThread() {
192 fetcher_ = new FakeDataFetcher(); 201 fetcher_ = new FakeDataFetcher();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 fetcher_->stopped_motion_.Wait(); 337 fetcher_->stopped_motion_.Wait();
329 fetcher_->started_orientation_.Wait(); 338 fetcher_->started_orientation_.Wait();
330 fetcher_->stopped_orientation_.Wait(); 339 fetcher_->stopped_orientation_.Wait();
331 same_tab_observer.Wait(); 340 same_tab_observer.Wait();
332 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); 341 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
333 } 342 }
334 343
335 } // namespace 344 } // namespace
336 345
337 } // namespace content 346 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc ('k') | content/browser/frame_host/debug_urls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698