| 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 "device/sensors/device_sensor_service.h" | 5 #include "services/device/sensors/device_sensor_service.h" |
| 6 |
| 6 #include <limits> | 7 #include <limits> |
| 7 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 9 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "device/sensors/data_fetcher_shared_memory.h" | |
| 12 #include "device/sensors/public/cpp/device_light_data.h" | |
| 13 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" | |
| 14 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" | |
| 15 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" | |
| 16 #include "device/sensors/public/cpp/motion_data.h" | |
| 17 #include "device/sensors/public/cpp/orientation_data.h" | |
| 18 #include "device/sensors/public/cpp/shared_memory_seqlock_reader.h" | |
| 19 #include "device/sensors/public/interfaces/light.mojom.h" | |
| 20 #include "device/sensors/public/interfaces/motion.mojom.h" | |
| 21 #include "device/sensors/public/interfaces/orientation.mojom.h" | |
| 22 #include "mojo/public/cpp/system/platform_handle.h" | 12 #include "mojo/public/cpp/system/platform_handle.h" |
| 23 #include "services/device/device_service_test_base.h" | 13 #include "services/device/device_service_test_base.h" |
| 14 #include "services/device/public/cpp/sensors/device_light_data.h" |
| 15 #include "services/device/public/cpp/sensors/device_light_hardware_buffer.h" |
| 16 #include "services/device/public/cpp/sensors/device_motion_hardware_buffer.h" |
| 17 #include "services/device/public/cpp/sensors/device_orientation_hardware_buffer.
h" |
| 18 #include "services/device/public/cpp/sensors/motion_data.h" |
| 19 #include "services/device/public/cpp/sensors/orientation_data.h" |
| 20 #include "services/device/public/cpp/sensors/shared_memory_seqlock_reader.h" |
| 24 #include "services/device/public/interfaces/constants.mojom.h" | 21 #include "services/device/public/interfaces/constants.mojom.h" |
| 22 #include "services/device/public/interfaces/light.mojom.h" |
| 23 #include "services/device/public/interfaces/motion.mojom.h" |
| 24 #include "services/device/public/interfaces/orientation.mojom.h" |
| 25 #include "services/device/sensors/data_fetcher_shared_memory.h" |
| 25 | 26 |
| 26 namespace device { | 27 namespace device { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 class FakeDataFetcher : public device::DataFetcherSharedMemory { | 31 class FakeDataFetcher : public device::DataFetcherSharedMemory { |
| 31 public: | 32 public: |
| 32 FakeDataFetcher() | 33 FakeDataFetcher() |
| 33 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 34 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 34 sensor_data_available_(true) {} | 35 sensor_data_available_(true) {} |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 EXPECT_TRUE(data.all_available_sensors_are_active); | 522 EXPECT_TRUE(data.all_available_sensors_are_active); |
| 522 | 523 |
| 523 motion_sensor_->StopPolling(); | 524 motion_sensor_->StopPolling(); |
| 524 polling_stopped_runloop_->Run(); | 525 polling_stopped_runloop_->Run(); |
| 525 EXPECT_FALSE(fetcher_->IsMotionPollingStarted()); | 526 EXPECT_FALSE(fetcher_->IsMotionPollingStarted()); |
| 526 } | 527 } |
| 527 | 528 |
| 528 } // namespace | 529 } // namespace |
| 529 | 530 |
| 530 } // namespace device | 531 } // namespace device |
| OLD | NEW |