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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "content/common/device_sensors/device_light_hardware_buffer.h" | 11 #include "content/common/device_sensors/device_light_hardware_buffer.h" |
12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 14 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 class MockDeviceLightListener : public blink::WebDeviceLightListener { | 18 class MockDeviceLightListener : public blink::WebDeviceLightListener { |
19 public: | 19 public: |
20 MockDeviceLightListener() : did_change_device_light_(false) {} | 20 MockDeviceLightListener() : did_change_device_light_(false) {} |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, | 153 FROM_HERE, base::Bind(&DeviceLightEventPumpForTesting::FireEvent, |
154 base::Unretained(light_pump()))); | 154 base::Unretained(light_pump()))); |
155 base::MessageLoop::current()->Run(); | 155 base::MessageLoop::current()->Run(); |
156 | 156 |
157 // No change in device light as present value is same as previous value. | 157 // No change in device light as present value is same as previous value. |
158 EXPECT_FALSE(listener()->did_change_device_light()); | 158 EXPECT_FALSE(listener()->did_change_device_light()); |
159 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); | 159 EXPECT_EQ(last_seen_data, static_cast<double>(received_data.value)); |
160 } | 160 } |
161 | 161 |
162 } // namespace content | 162 } // namespace content |
OLD | NEW |