| 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 "content/browser/device_sensors/data_fetcher_shared_memory.h" | 10 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" |
| 10 #include "content/browser/device_sensors/device_inertial_sensor_service.h" | 11 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
| 11 #include "content/common/device_sensors/device_light_hardware_buffer.h" | 12 #include "content/common/device_sensors/device_light_hardware_buffer.h" |
| 12 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 13 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
| 13 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | 14 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 17 #include "content/public/test/content_browser_test.h" | 18 #include "content/public/test/content_browser_test.h" |
| 18 #include "content/public/test/content_browser_test_utils.h" | 19 #include "content/public/test/content_browser_test_utils.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (!cmd_line->HasSwitch(switches::kEnableExperimentalWebPlatformFeatures)) | 228 if (!cmd_line->HasSwitch(switches::kEnableExperimentalWebPlatformFeatures)) |
| 228 cmd_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); | 229 cmd_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); |
| 229 } | 230 } |
| 230 | 231 |
| 231 FakeDataFetcher* fetcher_; | 232 FakeDataFetcher* fetcher_; |
| 232 | 233 |
| 233 private: | 234 private: |
| 234 base::WaitableEvent io_loop_finished_event_; | 235 base::WaitableEvent io_loop_finished_event_; |
| 235 }; | 236 }; |
| 236 | 237 |
| 237 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, OrientationTest) { | 238 // Flaky test. See http://crbug.com/628527. |
| 239 #if defined(ADDRESS_SANITIZER) && defined(OS_LINUX) |
| 240 #define MAYBE_OrientationTest DISABLED_OrientationTest |
| 241 #else |
| 242 #define MAYBE_OrientationTest OrientationTest |
| 243 #endif |
| 244 IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, |
| 245 MAYBE_OrientationTest) { |
| 238 // The test page will register an event handler for orientation events, | 246 // The test page will register an event handler for orientation events, |
| 239 // expects to get an event with fake values, then removes the event | 247 // expects to get an event with fake values, then removes the event |
| 240 // handler and navigates to #pass. | 248 // handler and navigates to #pass. |
| 241 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); | 249 GURL test_url = GetTestUrl("device_sensors", "device_orientation_test.html"); |
| 242 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 250 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 243 | 251 |
| 244 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 252 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 245 fetcher_->started_orientation_.Wait(); | 253 fetcher_->started_orientation_.Wait(); |
| 246 fetcher_->stopped_orientation_.Wait(); | 254 fetcher_->stopped_orientation_.Wait(); |
| 247 } | 255 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 fetcher_->stopped_motion_.Wait(); | 352 fetcher_->stopped_motion_.Wait(); |
| 345 fetcher_->started_orientation_.Wait(); | 353 fetcher_->started_orientation_.Wait(); |
| 346 fetcher_->stopped_orientation_.Wait(); | 354 fetcher_->stopped_orientation_.Wait(); |
| 347 same_tab_observer.Wait(); | 355 same_tab_observer.Wait(); |
| 348 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 356 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 349 } | 357 } |
| 350 | 358 |
| 351 } // namespace | 359 } // namespace |
| 352 | 360 |
| 353 } // namespace content | 361 } // namespace content |
| OLD | NEW |