| 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_light_event_pump.h" | 5 #include "device_light_event_pump.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "content/common/device_sensors/device_light_hardware_buffer.h" | |
| 13 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
| 13 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" |
| 14 #include "mojo/public/cpp/system/buffer.h" | 14 #include "mojo/public/cpp/system/buffer.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 16 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class MockDeviceLightListener : public blink::WebDeviceLightListener { | 20 class MockDeviceLightListener : public blink::WebDeviceLightListener { |
| 21 public: | 21 public: |
| 22 MockDeviceLightListener() : did_change_device_light_(false) {} | 22 MockDeviceLightListener() : did_change_device_light_(false) {} |
| 23 ~MockDeviceLightListener() override {} | 23 ~MockDeviceLightListener() override {} |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, | 150 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, |
| 151 base::Unretained(light_pump()))); | 151 base::Unretained(light_pump()))); |
| 152 base::RunLoop().Run(); | 152 base::RunLoop().Run(); |
| 153 | 153 |
| 154 // No change in device light as present value is same as previous value. | 154 // No change in device light as present value is same as previous value. |
| 155 EXPECT_FALSE(listener()->did_change_device_light()); | 155 EXPECT_FALSE(listener()->did_change_device_light()); |
| 156 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); | 156 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| OLD | NEW |