| 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 "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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // expects to get an event with fake values, then removes the event | 239 // expects to get an event with fake values, then removes the event |
| 240 // handler and navigates to #pass. | 240 // handler and navigates to #pass. |
| 241 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); | 241 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); |
| 242 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 242 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 243 | 243 |
| 244 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 244 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 245 fetcher_->started_orientation_.Wait(); | 245 fetcher_->started_orientation_.Wait(); |
| 246 fetcher_->stopped_orientation_.Wait(); | 246 fetcher_->stopped_orientation_.Wait(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, LightTest) { | 249 // Flaky test. See http://crbug.com/628527. |
| 250 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, DISABLED_LightTest) { |
| 250 // The test page will register an event handler for light events, | 251 // The test page will register an event handler for light events, |
| 251 // expects to get an event with fake values, then removes the event | 252 // expects to get an event with fake values, then removes the event |
| 252 // handler and navigates to #pass. | 253 // handler and navigates to #pass. |
| 253 EnableExperimentalFeatures(); | 254 EnableExperimentalFeatures(); |
| 254 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); | 255 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); |
| 255 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 256 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 256 | 257 |
| 257 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 258 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 258 fetcher_->started_light_.Wait(); | 259 fetcher_->started_light_.Wait(); |
| 259 fetcher_->stopped_light_.Wait(); | 260 fetcher_->stopped_light_.Wait(); |
| 260 } | 261 } |
| 261 | 262 |
| 262 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, MotionTest) { | 263 // Flaky test. See http://crbug.com/628527. |
| 264 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, DISABLED_MotionTest) { |
| 263 // The test page will register an event handler for motion events, | 265 // The test page will register an event handler for motion events, |
| 264 // expects to get an event with fake values, then removes the event | 266 // expects to get an event with fake values, then removes the event |
| 265 // handler and navigates to #pass. | 267 // handler and navigates to #pass. |
| 266 GURL test_url = GetTestUrl("device_sensors", "device_motion_test.html"); | 268 GURL test_url = GetTestUrl("device_sensors", "device_motion_test.html"); |
| 267 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 269 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 268 | 270 |
| 269 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 271 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 270 fetcher_->started_motion_.Wait(); | 272 fetcher_->started_motion_.Wait(); |
| 271 fetcher_->stopped_motion_.Wait(); | 273 fetcher_->stopped_motion_.Wait(); |
| 272 } | 274 } |
| 273 | 275 |
| 276 // Flaky test. See http://crbug.com/628527. |
| 274 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, | 277 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, |
| 275 LightOneOffInfintyTest) { | 278 DISABLED_LightOneOffInfintyTest) { |
| 276 // The test page registers an event handler for light events and expects | 279 // The test page registers an event handler for light events and expects |
| 277 // to get an event with value equal to infinity, because no sensor data can | 280 // to get an event with value equal to infinity, because no sensor data can |
| 278 // be provided. | 281 // be provided. |
| 279 EnableExperimentalFeatures(); | 282 EnableExperimentalFeatures(); |
| 280 fetcher_->SetSensorDataAvailable(false); | 283 fetcher_->SetSensorDataAvailable(false); |
| 281 GURL test_url = GetTestUrl("device_sensors", | 284 GURL test_url = GetTestUrl("device_sensors", |
| 282 "device_light_infinity_test.html"); | 285 "device_light_infinity_test.html"); |
| 283 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 286 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 284 | 287 |
| 285 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 288 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 286 fetcher_->started_light_.Wait(); | 289 fetcher_->started_light_.Wait(); |
| 287 fetcher_->stopped_light_.Wait(); | 290 fetcher_->stopped_light_.Wait(); |
| 288 } | 291 } |
| 289 | 292 |
| 290 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, OrientationNullTest) { | 293 // Flaky test. See http://crbug.com/628527. |
| 294 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, |
| 295 DISABLED_OrientationNullTest) { |
| 291 // The test page registers an event handler for orientation events and | 296 // The test page registers an event handler for orientation events and |
| 292 // expects to get an event with null values, because no sensor data can be | 297 // expects to get an event with null values, because no sensor data can be |
| 293 // provided. | 298 // provided. |
| 294 fetcher_->SetSensorDataAvailable(false); | 299 fetcher_->SetSensorDataAvailable(false); |
| 295 GURL test_url = GetTestUrl("device_sensors", | 300 GURL test_url = GetTestUrl("device_sensors", |
| 296 "device_orientation_null_test.html"); | 301 "device_orientation_null_test.html"); |
| 297 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 302 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 298 | 303 |
| 299 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 304 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 300 fetcher_->started_orientation_.Wait(); | 305 fetcher_->started_orientation_.Wait(); |
| 301 fetcher_->stopped_orientation_.Wait(); | 306 fetcher_->stopped_orientation_.Wait(); |
| 302 } | 307 } |
| 303 | 308 |
| 304 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, MotionNullTest) { | 309 // Flaky test. See http://crbug.com/628527. |
| 310 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, |
| 311 DISABLED_MotionNullTest) { |
| 305 // The test page registers an event handler for motion events and | 312 // The test page registers an event handler for motion events and |
| 306 // expects to get an event with null values, because no sensor data can be | 313 // expects to get an event with null values, because no sensor data can be |
| 307 // provided. | 314 // provided. |
| 308 fetcher_->SetSensorDataAvailable(false); | 315 fetcher_->SetSensorDataAvailable(false); |
| 309 GURL test_url = GetTestUrl("device_sensors", | 316 GURL test_url = GetTestUrl("device_sensors", |
| 310 "device_motion_null_test.html"); | 317 "device_motion_null_test.html"); |
| 311 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 318 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 312 | 319 |
| 313 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 320 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 314 fetcher_->started_motion_.Wait(); | 321 fetcher_->started_motion_.Wait(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 337 fetcher_->stopped_motion_.Wait(); | 344 fetcher_->stopped_motion_.Wait(); |
| 338 fetcher_->started_orientation_.Wait(); | 345 fetcher_->started_orientation_.Wait(); |
| 339 fetcher_->stopped_orientation_.Wait(); | 346 fetcher_->stopped_orientation_.Wait(); |
| 340 same_tab_observer.Wait(); | 347 same_tab_observer.Wait(); |
| 341 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 348 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 342 } | 349 } |
| 343 | 350 |
| 344 } // namespace | 351 } // namespace |
| 345 | 352 |
| 346 } // namespace content | 353 } // namespace content |
| OLD | NEW |