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/data_fetcher_shared_memory_base.h" | 5 #include "device/sensors/data_fetcher_shared_memory_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 base::WaitableEvent::InitialState::NOT_SIGNALED), | 46 base::WaitableEvent::InitialState::NOT_SIGNALED), |
47 updated_orientation_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 47 updated_orientation_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
48 base::WaitableEvent::InitialState::NOT_SIGNALED), | 48 base::WaitableEvent::InitialState::NOT_SIGNALED), |
49 updated_orientation_absolute_( | 49 updated_orientation_absolute_( |
50 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 50 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
51 base::WaitableEvent::InitialState::NOT_SIGNALED), | 51 base::WaitableEvent::InitialState::NOT_SIGNALED), |
52 light_buffer_(nullptr), | 52 light_buffer_(nullptr), |
53 motion_buffer_(nullptr), | 53 motion_buffer_(nullptr), |
54 orientation_buffer_(nullptr), | 54 orientation_buffer_(nullptr), |
55 orientation_absolute_buffer_(nullptr) {} | 55 orientation_absolute_buffer_(nullptr) {} |
56 ~FakeDataFetcher() override {} | 56 ~FakeDataFetcher() override { Shutdown(); } |
57 | 57 |
58 bool Init(ConsumerType consumer_type, void* buffer) { | 58 bool Init(ConsumerType consumer_type, void* buffer) { |
59 EXPECT_TRUE(buffer); | 59 EXPECT_TRUE(buffer); |
60 | 60 |
61 switch (consumer_type) { | 61 switch (consumer_type) { |
62 case CONSUMER_TYPE_MOTION: | 62 case CONSUMER_TYPE_MOTION: |
63 motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer); | 63 motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer); |
64 break; | 64 break; |
65 case CONSUMER_TYPE_ORIENTATION: | 65 case CONSUMER_TYPE_ORIENTATION: |
66 orientation_buffer_ = | 66 orientation_buffer_ = |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 fake_data_fetcher.StartFetchingDeviceData(CONSUMER_TYPE_ORIENTATION)); | 600 fake_data_fetcher.StartFetchingDeviceData(CONSUMER_TYPE_ORIENTATION)); |
601 fake_data_fetcher.WaitForStart(CONSUMER_TYPE_ORIENTATION); | 601 fake_data_fetcher.WaitForStart(CONSUMER_TYPE_ORIENTATION); |
602 EXPECT_EQ(0, fake_data_fetcher.GetOrientationBuffer()->data.alpha); | 602 EXPECT_EQ(0, fake_data_fetcher.GetOrientationBuffer()->data.alpha); |
603 fake_data_fetcher.StopFetchingDeviceData(CONSUMER_TYPE_ORIENTATION); | 603 fake_data_fetcher.StopFetchingDeviceData(CONSUMER_TYPE_ORIENTATION); |
604 fake_data_fetcher.WaitForStop(CONSUMER_TYPE_ORIENTATION); | 604 fake_data_fetcher.WaitForStop(CONSUMER_TYPE_ORIENTATION); |
605 } | 605 } |
606 | 606 |
607 } // namespace | 607 } // namespace |
608 | 608 |
609 } // namespace device | 609 } // namespace device |
OLD | NEW |