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/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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 fetcher_->stopped_orientation_.Wait(); | 231 fetcher_->stopped_orientation_.Wait(); |
232 } | 232 } |
233 | 233 |
234 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, LightTest) { | 234 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, LightTest) { |
235 // The test page will register an event handler for light events, | 235 // The test page will register an event handler for light events, |
236 // expects to get an event with fake values, then removes the event | 236 // expects to get an event with fake values, then removes the event |
237 // handler and navigates to #pass. | 237 // handler and navigates to #pass. |
238 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); | 238 GURL test_url = GetTestUrl("device_sensors", "device_light_test.html"); |
239 | 239 |
240 // TODO(riju): remove command line args when the feature goes stable. | 240 // TODO(riju): remove command line args when the feature goes stable. |
241 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 241 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
242 switches::kEnableExperimentalWebPlatformFeatures)) { | 242 switches::kEnableExperimentalWebPlatformFeatures)) { |
243 CommandLine::ForCurrentProcess()->AppendSwitch( | 243 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
244 switches::kEnableExperimentalWebPlatformFeatures); | 244 switches::kEnableExperimentalWebPlatformFeatures); |
245 } | 245 } |
246 | 246 |
247 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 247 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
248 | 248 |
249 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 249 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
250 fetcher_->started_light_.Wait(); | 250 fetcher_->started_light_.Wait(); |
251 fetcher_->stopped_light_.Wait(); | 251 fetcher_->stopped_light_.Wait(); |
252 } | 252 } |
253 | 253 |
(...skipping 12 matching lines...) Expand all Loading... |
266 // crbug/416406. The test is flaky. | 266 // crbug/416406. The test is flaky. |
267 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, | 267 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, |
268 DISABLED_LightOneOffInfintyTest) { | 268 DISABLED_LightOneOffInfintyTest) { |
269 // The test page will register an event handler for light events, | 269 // The test page will register an event handler for light events, |
270 // expects to get an event with value equal to Infinity. This tests that the | 270 // expects to get an event with value equal to Infinity. This tests that the |
271 // one-off infinity event still propagates to window after the alert is | 271 // one-off infinity event still propagates to window after the alert is |
272 // dismissed and the callback is invoked which navigates to #pass. | 272 // dismissed and the callback is invoked which navigates to #pass. |
273 fetcher_->SetSensorDataAvailable(false); | 273 fetcher_->SetSensorDataAvailable(false); |
274 | 274 |
275 // TODO(riju): remove command line args when the feature goes stable. | 275 // TODO(riju): remove command line args when the feature goes stable. |
276 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 276 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
277 switches::kEnableExperimentalWebPlatformFeatures)) { | 277 switches::kEnableExperimentalWebPlatformFeatures)) { |
278 CommandLine::ForCurrentProcess()->AppendSwitch( | 278 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
279 switches::kEnableExperimentalWebPlatformFeatures); | 279 switches::kEnableExperimentalWebPlatformFeatures); |
280 } | 280 } |
281 | 281 |
282 TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); | 282 TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); |
283 | 283 |
284 GURL test_url = | 284 GURL test_url = |
285 GetTestUrl("device_sensors", "device_light_infinity_test.html"); | 285 GetTestUrl("device_sensors", "device_light_infinity_test.html"); |
286 shell()->LoadURL(test_url); | 286 shell()->LoadURL(test_url); |
287 | 287 |
288 WaitForAlertDialogAndQuitAfterDelay(base::TimeDelta::FromMilliseconds(1000)); | 288 WaitForAlertDialogAndQuitAfterDelay(base::TimeDelta::FromMilliseconds(1000)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 fetcher_->started_motion_.Wait(); | 350 fetcher_->started_motion_.Wait(); |
351 fetcher_->stopped_motion_.Wait(); | 351 fetcher_->stopped_motion_.Wait(); |
352 same_tab_observer.Wait(); | 352 same_tab_observer.Wait(); |
353 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 353 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
354 } | 354 } |
355 | 355 |
356 } // namespace | 356 } // namespace |
357 | 357 |
358 } // namespace content | 358 } // namespace content |
OLD | NEW |