| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/memory/singleton.h" | 7 #include "base/memory/singleton.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 29 matching lines...) Expand all Loading... |
| 40 bool StartSensor( | 40 bool StartSensor( |
| 41 const device::PlatformSensorConfiguration& configuration) override { | 41 const device::PlatformSensorConfiguration& configuration) override { |
| 42 device::SensorReading reading; | 42 device::SensorReading reading; |
| 43 reading.timestamp = | 43 reading.timestamp = |
| 44 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | 44 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 45 reading.values[0] = 50; | 45 reading.values[0] = 50; |
| 46 UpdateSensorReading(reading, true); | 46 UpdateSensorReading(reading, true); |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void StopSensor() override {}; | 50 void StopSensor() override {} |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 ~FakeAmbientLightSensor() override = default; | 53 ~FakeAmbientLightSensor() override = default; |
| 54 bool CheckSensorConfiguration( | 54 bool CheckSensorConfiguration( |
| 55 const device::PlatformSensorConfiguration& configuration) override { | 55 const device::PlatformSensorConfiguration& configuration) override { |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 device::PlatformSensorConfiguration GetDefaultConfiguration() override { | 58 device::PlatformSensorConfiguration GetDefaultConfiguration() override { |
| 59 return device::PlatformSensorConfiguration(60 /* frequency */); | 59 return device::PlatformSensorConfiguration(60 /* frequency */); |
| 60 } | 60 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // expects to get events with fake values then navigates to #pass. | 126 // expects to get events with fake values then navigates to #pass. |
| 127 GURL test_url = | 127 GURL test_url = |
| 128 GetTestUrl("generic_sensor", "ambient_light_sensor_test.html"); | 128 GetTestUrl("generic_sensor", "ambient_light_sensor_test.html"); |
| 129 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 129 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
| 130 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 130 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |