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/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 // handler and navigates to #pass. | 308 // handler and navigates to #pass. |
309 GURL test_url = | 309 GURL test_url = |
310 GetTestUrl("device_sensors", "device_orientation_absolute_test.html"); | 310 GetTestUrl("device_sensors", "device_orientation_absolute_test.html"); |
311 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 311 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
312 | 312 |
313 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 313 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
314 orientation_absolute_started_runloop_->Run(); | 314 orientation_absolute_started_runloop_->Run(); |
315 orientation_absolute_stopped_runloop_->Run(); | 315 orientation_absolute_stopped_runloop_->Run(); |
316 } | 316 } |
317 | 317 |
318 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, MotionTest) { | |
Reilly Grant (use Gerrit)
2017/05/22 20:29:46
Where did these tests move to?
juncai
2017/05/23 02:30:23
Talked to reillyg@ offline, these tests are alread
timvolodine
2017/05/23 12:33:40
what is the reason for removing this? strictly spe
juncai
2017/05/23 21:33:55
I think the layout tests at: //third_party/WebKit/
timvolodine
2017/05/24 15:30:15
The //third_party/WebKit/LayoutTests/device_orient
juncai
2017/05/26 02:38:52
Thanks for the comments. I updated device sensors
| |
319 // The test page will register an event handler for motion events, | |
320 // expects to get an event with fake values, then removes the event | |
321 // handler and navigates to #pass. | |
322 GURL test_url = GetTestUrl("device_sensors", "device_motion_test.html"); | |
323 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | |
324 | |
325 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | |
326 motion_started_runloop_->Run(); | |
327 motion_stopped_runloop_->Run(); | |
328 } | |
329 | |
330 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationNullTest) { | 318 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationNullTest) { |
331 // The test page registers an event handler for orientation events and | 319 // The test page registers an event handler for orientation events and |
332 // expects to get an event with null values, because no sensor data can be | 320 // expects to get an event with null values, because no sensor data can be |
333 // provided. | 321 // provided. |
334 fetcher_->SetSensorDataAvailable(false); | 322 fetcher_->SetSensorDataAvailable(false); |
335 GURL test_url = | 323 GURL test_url = |
336 GetTestUrl("device_sensors", "device_orientation_null_test.html"); | 324 GetTestUrl("device_sensors", "device_orientation_null_test.html"); |
337 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 325 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
338 | 326 |
339 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 327 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
340 orientation_started_runloop_->Run(); | 328 orientation_started_runloop_->Run(); |
341 orientation_stopped_runloop_->Run(); | 329 orientation_stopped_runloop_->Run(); |
342 } | 330 } |
343 | 331 |
344 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationAbsoluteNullTest) { | 332 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationAbsoluteNullTest) { |
345 // The test page registers an event handler for absolute orientation events | 333 // The test page registers an event handler for absolute orientation events |
346 // and expects to get an event with null values, because no sensor data can be | 334 // and expects to get an event with null values, because no sensor data can be |
347 // provided. | 335 // provided. |
348 fetcher_->SetSensorDataAvailable(false); | 336 fetcher_->SetSensorDataAvailable(false); |
349 GURL test_url = GetTestUrl("device_sensors", | 337 GURL test_url = GetTestUrl("device_sensors", |
350 "device_orientation_absolute_null_test.html"); | 338 "device_orientation_absolute_null_test.html"); |
351 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 339 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
352 | 340 |
353 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 341 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
354 orientation_absolute_started_runloop_->Run(); | 342 orientation_absolute_started_runloop_->Run(); |
355 orientation_absolute_stopped_runloop_->Run(); | 343 orientation_absolute_stopped_runloop_->Run(); |
356 } | 344 } |
357 | 345 |
358 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, MotionNullTest) { | |
359 // The test page registers an event handler for motion events and | |
360 // expects to get an event with null values, because no sensor data can be | |
361 // provided. | |
362 fetcher_->SetSensorDataAvailable(false); | |
363 GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html"); | |
364 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | |
365 | |
366 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | |
367 motion_started_runloop_->Run(); | |
368 motion_stopped_runloop_->Run(); | |
369 } | |
370 | |
371 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, NullTestWithAlert) { | 346 IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, NullTestWithAlert) { |
372 // The test page registers an event handlers for motion/orientation events and | 347 // The test page registers an event handlers for motion/orientation events and |
373 // expects to get events with null values. The test raises a modal alert | 348 // expects to get events with null values. The test raises a modal alert |
374 // dialog with a delay to test that the one-off null-events still propagate to | 349 // dialog with a delay to test that the one-off null-events still propagate to |
375 // window after the alert is dismissed and the callbacks are invoked which | 350 // window after the alert is dismissed and the callbacks are invoked which |
376 // eventually navigate to #pass. | 351 // eventually navigate to #pass. |
377 fetcher_->SetSensorDataAvailable(false); | 352 fetcher_->SetSensorDataAvailable(false); |
378 TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); | 353 TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); |
379 | 354 |
380 GURL test_url = | 355 GURL test_url = |
381 GetTestUrl("device_sensors", "device_sensors_null_test_with_alert.html"); | 356 GetTestUrl("device_sensors", "device_sensors_null_test_with_alert.html"); |
382 shell()->LoadURL(test_url); | 357 shell()->LoadURL(test_url); |
383 | 358 |
384 // TODO(timvolodine): investigate if it is possible to test this without | 359 // TODO(timvolodine): investigate if it is possible to test this without |
385 // delay, crbug.com/360044. | 360 // delay, crbug.com/360044. |
386 WaitForAlertDialogAndQuitAfterDelay(base::TimeDelta::FromMilliseconds(500)); | 361 WaitForAlertDialogAndQuitAfterDelay(base::TimeDelta::FromMilliseconds(500)); |
387 | 362 |
388 motion_started_runloop_->Run(); | |
389 motion_stopped_runloop_->Run(); | |
390 orientation_started_runloop_->Run(); | 363 orientation_started_runloop_->Run(); |
391 orientation_stopped_runloop_->Run(); | 364 orientation_stopped_runloop_->Run(); |
392 same_tab_observer.Wait(); | 365 same_tab_observer.Wait(); |
393 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 366 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
394 } | 367 } |
395 | 368 |
396 } // namespace | 369 } // namespace |
397 | 370 |
398 } // namespace content | 371 } // namespace content |
OLD | NEW |