| 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 "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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void SetOrientationStartedCallback( | 50 void SetOrientationStartedCallback( |
| 51 base::Closure orientation_started_callback) { | 51 base::Closure orientation_started_callback) { |
| 52 orientation_started_callback_ = orientation_started_callback; | 52 orientation_started_callback_ = orientation_started_callback; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void SetOrientationStoppedCallback( | 55 void SetOrientationStoppedCallback( |
| 56 base::Closure orientation_stopped_callback) { | 56 base::Closure orientation_stopped_callback) { |
| 57 orientation_stopped_callback_ = orientation_stopped_callback; | 57 orientation_stopped_callback_ = orientation_stopped_callback; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SetOrientationAbsoluteStartedCallback( |
| 61 base::Closure orientation_absolute_started_callback) { |
| 62 orientation_absolute_started_callback_ = |
| 63 orientation_absolute_started_callback; |
| 64 } |
| 65 |
| 66 void SetOrientationAbsoluteStoppedCallback( |
| 67 base::Closure orientation_absolute_stopped_callback) { |
| 68 orientation_absolute_stopped_callback_ = |
| 69 orientation_absolute_stopped_callback; |
| 70 } |
| 71 |
| 60 bool Start(device::ConsumerType consumer_type, void* buffer) override { | 72 bool Start(device::ConsumerType consumer_type, void* buffer) override { |
| 61 EXPECT_TRUE(buffer); | 73 EXPECT_TRUE(buffer); |
| 62 | 74 |
| 63 switch (consumer_type) { | 75 switch (consumer_type) { |
| 64 case device::CONSUMER_TYPE_MOTION: { | 76 case device::CONSUMER_TYPE_MOTION: { |
| 65 device::DeviceMotionHardwareBuffer* motion_buffer = | 77 device::DeviceMotionHardwareBuffer* motion_buffer = |
| 66 static_cast<device::DeviceMotionHardwareBuffer*>(buffer); | 78 static_cast<device::DeviceMotionHardwareBuffer*>(buffer); |
| 67 if (sensor_data_available_) | 79 if (sensor_data_available_) |
| 68 UpdateMotion(motion_buffer); | 80 UpdateMotion(motion_buffer); |
| 69 SetMotionBufferReady(motion_buffer); | 81 SetMotionBufferReady(motion_buffer); |
| 70 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 82 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 71 motion_started_callback_); | 83 motion_started_callback_); |
| 72 } break; | 84 } break; |
| 73 case device::CONSUMER_TYPE_ORIENTATION: { | 85 case device::CONSUMER_TYPE_ORIENTATION: { |
| 74 device::DeviceOrientationHardwareBuffer* orientation_buffer = | 86 device::DeviceOrientationHardwareBuffer* orientation_buffer = |
| 75 static_cast<device::DeviceOrientationHardwareBuffer*>(buffer); | 87 static_cast<device::DeviceOrientationHardwareBuffer*>(buffer); |
| 76 if (sensor_data_available_) | 88 if (sensor_data_available_) |
| 77 UpdateOrientation(orientation_buffer); | 89 UpdateOrientation(orientation_buffer); |
| 78 SetOrientationBufferReady(orientation_buffer); | 90 SetOrientationBufferReady(orientation_buffer); |
| 79 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 91 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 80 orientation_started_callback_); | 92 orientation_started_callback_); |
| 81 } break; | 93 } break; |
| 94 case device::CONSUMER_TYPE_ORIENTATION_ABSOLUTE: { |
| 95 device::DeviceOrientationHardwareBuffer* orientation_buffer = |
| 96 static_cast<device::DeviceOrientationHardwareBuffer*>(buffer); |
| 97 if (sensor_data_available_) |
| 98 UpdateOrientationAbsolute(orientation_buffer); |
| 99 SetOrientationBufferReady(orientation_buffer); |
| 100 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 101 orientation_absolute_started_callback_); |
| 102 } break; |
| 82 case device::CONSUMER_TYPE_LIGHT: { | 103 case device::CONSUMER_TYPE_LIGHT: { |
| 83 device::DeviceLightHardwareBuffer* light_buffer = | 104 device::DeviceLightHardwareBuffer* light_buffer = |
| 84 static_cast<device::DeviceLightHardwareBuffer*>(buffer); | 105 static_cast<device::DeviceLightHardwareBuffer*>(buffer); |
| 85 UpdateLight(light_buffer, | 106 UpdateLight(light_buffer, |
| 86 sensor_data_available_ | 107 sensor_data_available_ |
| 87 ? 100 | 108 ? 100 |
| 88 : std::numeric_limits<double>::infinity()); | 109 : std::numeric_limits<double>::infinity()); |
| 89 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 110 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 90 light_started_callback_); | 111 light_started_callback_); |
| 91 } break; | 112 } break; |
| 92 default: | 113 default: |
| 93 return false; | 114 return false; |
| 94 } | 115 } |
| 95 return true; | 116 return true; |
| 96 } | 117 } |
| 97 | 118 |
| 98 bool Stop(device::ConsumerType consumer_type) override { | 119 bool Stop(device::ConsumerType consumer_type) override { |
| 99 switch (consumer_type) { | 120 switch (consumer_type) { |
| 100 case device::CONSUMER_TYPE_MOTION: | 121 case device::CONSUMER_TYPE_MOTION: |
| 101 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 122 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 102 motion_stopped_callback_); | 123 motion_stopped_callback_); |
| 103 break; | 124 break; |
| 104 case device::CONSUMER_TYPE_ORIENTATION: | 125 case device::CONSUMER_TYPE_ORIENTATION: |
| 105 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 126 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 106 orientation_stopped_callback_); | 127 orientation_stopped_callback_); |
| 107 break; | 128 break; |
| 129 case device::CONSUMER_TYPE_ORIENTATION_ABSOLUTE: |
| 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 131 orientation_absolute_stopped_callback_); |
| 132 break; |
| 108 case device::CONSUMER_TYPE_LIGHT: | 133 case device::CONSUMER_TYPE_LIGHT: |
| 109 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 134 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 110 light_stopped_callback_); | 135 light_stopped_callback_); |
| 111 break; | 136 break; |
| 112 default: | 137 default: |
| 113 return false; | 138 return false; |
| 114 } | 139 } |
| 115 return true; | 140 return true; |
| 116 } | 141 } |
| 117 | 142 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 buffer->data.alpha = 1; | 196 buffer->data.alpha = 1; |
| 172 buffer->data.hasAlpha = true; | 197 buffer->data.hasAlpha = true; |
| 173 buffer->data.beta = 2; | 198 buffer->data.beta = 2; |
| 174 buffer->data.hasBeta = true; | 199 buffer->data.hasBeta = true; |
| 175 buffer->data.gamma = 3; | 200 buffer->data.gamma = 3; |
| 176 buffer->data.hasGamma = true; | 201 buffer->data.hasGamma = true; |
| 177 buffer->data.allAvailableSensorsAreActive = true; | 202 buffer->data.allAvailableSensorsAreActive = true; |
| 178 buffer->seqlock.WriteEnd(); | 203 buffer->seqlock.WriteEnd(); |
| 179 } | 204 } |
| 180 | 205 |
| 206 void UpdateOrientationAbsolute( |
| 207 device::DeviceOrientationHardwareBuffer* buffer) { |
| 208 buffer->seqlock.WriteBegin(); |
| 209 buffer->data.alpha = 4; |
| 210 buffer->data.hasAlpha = true; |
| 211 buffer->data.beta = 5; |
| 212 buffer->data.hasBeta = true; |
| 213 buffer->data.gamma = 6; |
| 214 buffer->data.hasGamma = true; |
| 215 buffer->data.absolute = true; |
| 216 buffer->data.allAvailableSensorsAreActive = true; |
| 217 buffer->seqlock.WriteEnd(); |
| 218 } |
| 219 |
| 181 void UpdateLight(device::DeviceLightHardwareBuffer* buffer, double lux) { | 220 void UpdateLight(device::DeviceLightHardwareBuffer* buffer, double lux) { |
| 182 buffer->seqlock.WriteBegin(); | 221 buffer->seqlock.WriteBegin(); |
| 183 buffer->data.value = lux; | 222 buffer->data.value = lux; |
| 184 buffer->seqlock.WriteEnd(); | 223 buffer->seqlock.WriteEnd(); |
| 185 } | 224 } |
| 186 | 225 |
| 187 // The below callbacks should be run on the UI thread. | 226 // The below callbacks should be run on the UI thread. |
| 188 base::Closure motion_started_callback_; | 227 base::Closure motion_started_callback_; |
| 189 base::Closure orientation_started_callback_; | 228 base::Closure orientation_started_callback_; |
| 229 base::Closure orientation_absolute_started_callback_; |
| 190 base::Closure light_started_callback_; | 230 base::Closure light_started_callback_; |
| 191 base::Closure motion_stopped_callback_; | 231 base::Closure motion_stopped_callback_; |
| 192 base::Closure orientation_stopped_callback_; | 232 base::Closure orientation_stopped_callback_; |
| 233 base::Closure orientation_absolute_stopped_callback_; |
| 193 base::Closure light_stopped_callback_; | 234 base::Closure light_stopped_callback_; |
| 194 bool sensor_data_available_; | 235 bool sensor_data_available_; |
| 195 | 236 |
| 196 private: | 237 private: |
| 197 DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); | 238 DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); |
| 198 }; | 239 }; |
| 199 | 240 |
| 200 class DeviceSensorBrowserTest : public ContentBrowserTest { | 241 class DeviceSensorBrowserTest : public ContentBrowserTest { |
| 201 public: | 242 public: |
| 202 DeviceSensorBrowserTest() | 243 DeviceSensorBrowserTest() |
| 203 : fetcher_(nullptr), | 244 : fetcher_(nullptr), |
| 204 io_loop_finished_event_( | 245 io_loop_finished_event_( |
| 205 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 246 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 206 base::WaitableEvent::InitialState::NOT_SIGNALED) {} | 247 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 207 | 248 |
| 208 void SetUpOnMainThread() override { | 249 void SetUpOnMainThread() override { |
| 209 // Initialize the RunLoops now that the main thread has been created. | 250 // Initialize the RunLoops now that the main thread has been created. |
| 210 light_started_runloop_.reset(new base::RunLoop()); | 251 light_started_runloop_.reset(new base::RunLoop()); |
| 211 light_stopped_runloop_.reset(new base::RunLoop()); | 252 light_stopped_runloop_.reset(new base::RunLoop()); |
| 212 motion_started_runloop_.reset(new base::RunLoop()); | 253 motion_started_runloop_.reset(new base::RunLoop()); |
| 213 motion_stopped_runloop_.reset(new base::RunLoop()); | 254 motion_stopped_runloop_.reset(new base::RunLoop()); |
| 214 orientation_started_runloop_.reset(new base::RunLoop()); | 255 orientation_started_runloop_.reset(new base::RunLoop()); |
| 215 orientation_stopped_runloop_.reset(new base::RunLoop()); | 256 orientation_stopped_runloop_.reset(new base::RunLoop()); |
| 257 orientation_absolute_started_runloop_.reset(new base::RunLoop()); |
| 258 orientation_absolute_stopped_runloop_.reset(new base::RunLoop()); |
| 216 #if defined(OS_ANDROID) | 259 #if defined(OS_ANDROID) |
| 217 // On Android, the DeviceSensorService lives on the UI thread. | 260 // On Android, the DeviceSensorService lives on the UI thread. |
| 218 SetUpFetcher(); | 261 SetUpFetcher(); |
| 219 #else | 262 #else |
| 220 // On all other platforms, the DeviceSensorService lives on the IO thread. | 263 // On all other platforms, the DeviceSensorService lives on the IO thread. |
| 221 BrowserThread::PostTask( | 264 BrowserThread::PostTask( |
| 222 BrowserThread::IO, FROM_HERE, | 265 BrowserThread::IO, FROM_HERE, |
| 223 base::Bind(&DeviceSensorBrowserTest::SetUpOnIOThread, | 266 base::Bind(&DeviceSensorBrowserTest::SetUpOnIOThread, |
| 224 base::Unretained(this))); | 267 base::Unretained(this))); |
| 225 io_loop_finished_event_.Wait(); | 268 io_loop_finished_event_.Wait(); |
| 226 #endif | 269 #endif |
| 227 } | 270 } |
| 228 | 271 |
| 229 void SetUpFetcher() { | 272 void SetUpFetcher() { |
| 230 fetcher_ = new FakeDataFetcher(); | 273 fetcher_ = new FakeDataFetcher(); |
| 231 fetcher_->SetLightStartedCallback(light_started_runloop_->QuitClosure()); | 274 fetcher_->SetLightStartedCallback(light_started_runloop_->QuitClosure()); |
| 232 fetcher_->SetLightStoppedCallback(light_stopped_runloop_->QuitClosure()); | 275 fetcher_->SetLightStoppedCallback(light_stopped_runloop_->QuitClosure()); |
| 233 fetcher_->SetMotionStartedCallback(motion_started_runloop_->QuitClosure()); | 276 fetcher_->SetMotionStartedCallback(motion_started_runloop_->QuitClosure()); |
| 234 fetcher_->SetMotionStoppedCallback(motion_stopped_runloop_->QuitClosure()); | 277 fetcher_->SetMotionStoppedCallback(motion_stopped_runloop_->QuitClosure()); |
| 235 fetcher_->SetOrientationStartedCallback( | 278 fetcher_->SetOrientationStartedCallback( |
| 236 orientation_started_runloop_->QuitClosure()); | 279 orientation_started_runloop_->QuitClosure()); |
| 237 fetcher_->SetOrientationStoppedCallback( | 280 fetcher_->SetOrientationStoppedCallback( |
| 238 orientation_stopped_runloop_->QuitClosure()); | 281 orientation_stopped_runloop_->QuitClosure()); |
| 282 fetcher_->SetOrientationAbsoluteStartedCallback( |
| 283 orientation_absolute_started_runloop_->QuitClosure()); |
| 284 fetcher_->SetOrientationAbsoluteStoppedCallback( |
| 285 orientation_absolute_stopped_runloop_->QuitClosure()); |
| 239 device::DeviceSensorService::GetInstance()->SetDataFetcherForTesting( | 286 device::DeviceSensorService::GetInstance()->SetDataFetcherForTesting( |
| 240 fetcher_); | 287 fetcher_); |
| 241 } | 288 } |
| 242 | 289 |
| 243 void SetUpOnIOThread() { | 290 void SetUpOnIOThread() { |
| 244 SetUpFetcher(); | 291 SetUpFetcher(); |
| 245 io_loop_finished_event_.Signal(); | 292 io_loop_finished_event_.Signal(); |
| 246 } | 293 } |
| 247 | 294 |
| 248 void DelayAndQuit(base::TimeDelta delay) { | 295 void DelayAndQuit(base::TimeDelta delay) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 272 FakeDataFetcher* fetcher_; | 319 FakeDataFetcher* fetcher_; |
| 273 | 320 |
| 274 // NOTE: These can only be initialized once the main thread has been created | 321 // NOTE: These can only be initialized once the main thread has been created |
| 275 // and so must be pointers instead of plain objects. | 322 // and so must be pointers instead of plain objects. |
| 276 std::unique_ptr<base::RunLoop> light_started_runloop_; | 323 std::unique_ptr<base::RunLoop> light_started_runloop_; |
| 277 std::unique_ptr<base::RunLoop> light_stopped_runloop_; | 324 std::unique_ptr<base::RunLoop> light_stopped_runloop_; |
| 278 std::unique_ptr<base::RunLoop> motion_started_runloop_; | 325 std::unique_ptr<base::RunLoop> motion_started_runloop_; |
| 279 std::unique_ptr<base::RunLoop> motion_stopped_runloop_; | 326 std::unique_ptr<base::RunLoop> motion_stopped_runloop_; |
| 280 std::unique_ptr<base::RunLoop> orientation_started_runloop_; | 327 std::unique_ptr<base::RunLoop> orientation_started_runloop_; |
| 281 std::unique_ptr<base::RunLoop> orientation_stopped_runloop_; | 328 std::unique_ptr<base::RunLoop> orientation_stopped_runloop_; |
| 329 std::unique_ptr<base::RunLoop> orientation_absolute_started_runloop_; |
| 330 std::unique_ptr<base::RunLoop> orientation_absolute_stopped_runloop_; |
| 282 | 331 |
| 283 private: | 332 private: |
| 284 base::WaitableEvent io_loop_finished_event_; | 333 base::WaitableEvent io_loop_finished_event_; |
| 285 }; | 334 }; |
| 286 | 335 |
| 287 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationTest) { | 336 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationTest) { |
| 288 // The test page will register an event handler for orientation events, | 337 // The test page will register an event handler for orientation events, |
| 289 // expects to get an event with fake values, then removes the event | 338 // expects to get an event with fake values, then removes the event |
| 290 // handler and navigates to #pass. | 339 // handler and navigates to #pass. |
| 291 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); | 340 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); |
| 292 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 341 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 293 | 342 |
| 294 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 343 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 295 orientation_started_runloop_->Run(); | 344 orientation_started_runloop_->Run(); |
| 296 orientation_stopped_runloop_->Run(); | 345 orientation_stopped_runloop_->Run(); |
| 297 } | 346 } |
| 298 | 347 |
| 348 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationAbsoluteTest) { |
| 349 // The test page will register an event handler for absolute orientation |
| 350 // events, expects to get an event with fake values, then removes the event |
| 351 // handler and navigates to #pass. |
| 352 GURL test_url = |
| 353 GetTestUrl("device_sensors", "device_orientation_absolute_test.html"); |
| 354 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 355 |
| 356 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 357 orientation_absolute_started_runloop_->Run(); |
| 358 orientation_absolute_stopped_runloop_->Run(); |
| 359 } |
| 360 |
| 299 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, LightTest) { | 361 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, LightTest) { |
| 300 // The test page will register an event handler for light events, | 362 // The test page will register an event handler for light events, |
| 301 // expects to get an event with fake values, then removes the event | 363 // expects to get an event with fake values, then removes the event |
| 302 // handler and navigates to #pass. | 364 // handler and navigates to #pass. |
| 303 EnableExperimentalFeatures(); | 365 EnableExperimentalFeatures(); |
| 304 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); | 366 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); |
| 305 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 367 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 306 | 368 |
| 307 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 369 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 308 light_started_runloop_->Run(); | 370 light_started_runloop_->Run(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 fetcher_->SetSensorDataAvailable(false); | 405 fetcher_->SetSensorDataAvailable(false); |
| 344 GURL test_url = | 406 GURL test_url = |
| 345 GetTestUrl("device_sensors", "device_orientation_null_test.html"); | 407 GetTestUrl("device_sensors", "device_orientation_null_test.html"); |
| 346 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 408 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 347 | 409 |
| 348 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 410 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 349 orientation_started_runloop_->Run(); | 411 orientation_started_runloop_->Run(); |
| 350 orientation_stopped_runloop_->Run(); | 412 orientation_stopped_runloop_->Run(); |
| 351 } | 413 } |
| 352 | 414 |
| 415 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationAbsoluteNullTest) { |
| 416 // The test page registers an event handler for absolute orientation events |
| 417 // and expects to get an event with null values, because no sensor data can be |
| 418 // provided. |
| 419 fetcher_->SetSensorDataAvailable(false); |
| 420 GURL test_url = GetTestUrl("device_sensors", |
| 421 "device_orientation_absolute_null_test.html"); |
| 422 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 423 |
| 424 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 425 orientation_absolute_started_runloop_->Run(); |
| 426 orientation_absolute_stopped_runloop_->Run(); |
| 427 } |
| 428 |
| 353 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, MotionNullTest) { | 429 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, MotionNullTest) { |
| 354 // The test page registers an event handler for motion events and | 430 // The test page registers an event handler for motion events and |
| 355 // expects to get an event with null values, because no sensor data can be | 431 // expects to get an event with null values, because no sensor data can be |
| 356 // provided. | 432 // provided. |
| 357 fetcher_->SetSensorDataAvailable(false); | 433 fetcher_->SetSensorDataAvailable(false); |
| 358 GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html"); | 434 GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html"); |
| 359 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 435 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 360 | 436 |
| 361 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 437 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 362 motion_started_runloop_->Run(); | 438 motion_started_runloop_->Run(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 384 motion_stopped_runloop_->Run(); | 460 motion_stopped_runloop_->Run(); |
| 385 orientation_started_runloop_->Run(); | 461 orientation_started_runloop_->Run(); |
| 386 orientation_stopped_runloop_->Run(); | 462 orientation_stopped_runloop_->Run(); |
| 387 same_tab_observer.Wait(); | 463 same_tab_observer.Wait(); |
| 388 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 464 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 389 } | 465 } |
| 390 | 466 |
| 391 } // namespace | 467 } // namespace |
| 392 | 468 |
| 393 } // namespace content | 469 } // namespace content |
| OLD | NEW |