| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <new> | 7 #include <new> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/test/scoped_task_environment.h" |
| 16 #include "base/test/test_simple_task_runner.h" | 17 #include "base/test/test_simple_task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 #include "content/common/input/synthetic_web_input_event_builders.h" | 20 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 20 #include "content/common/input_messages.h" | 21 #include "content/common/input_messages.h" |
| 21 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
| 22 #include "content/public/common/content_features.h" | 23 #include "content/public/common/content_features.h" |
| 23 #include "content/renderer/input/input_event_filter.h" | 24 #include "content/renderer/input/input_event_filter.h" |
| 24 #include "content/renderer/input/input_handler_manager.h" | 25 #include "content/renderer/input/input_handler_manager.h" |
| 25 #include "ipc/ipc_listener.h" | 26 #include "ipc/ipc_listener.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ui::LatencyInfo(), | 187 ui::LatencyInfo(), |
| 187 ShouldBlockEventStream(events[i]) | 188 ShouldBlockEventStream(events[i]) |
| 188 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING | 189 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING |
| 189 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING)); | 190 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 AddMessagesToFilter(messages); | 193 AddMessagesToFilter(messages); |
| 193 } | 194 } |
| 194 | 195 |
| 195 protected: | 196 protected: |
| 196 base::MessageLoop message_loop_; | 197 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 197 scoped_refptr<base::TestSimpleTaskRunner> main_task_runner_; | 198 scoped_refptr<base::TestSimpleTaskRunner> main_task_runner_; |
| 198 | 199 |
| 199 // Used to record IPCs sent by the filter to the RenderWidgetHost. | 200 // Used to record IPCs sent by the filter to the RenderWidgetHost. |
| 200 IPC::TestSink ipc_sink_; | 201 IPC::TestSink ipc_sink_; |
| 201 | 202 |
| 202 // Used to record IPCs forwarded by the filter to the main thread. | 203 // Used to record IPCs forwarded by the filter to the main thread. |
| 203 IPCMessageRecorder message_recorder_; | 204 IPCMessageRecorder message_recorder_; |
| 204 | 205 |
| 205 scoped_refptr<InputEventFilter> filter_; | 206 scoped_refptr<InputEventFilter> filter_; |
| 206 | 207 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 const WebInputEvent* event = std::get<0>(params); | 534 const WebInputEvent* event = std::get<0>(params); |
| 534 InputEventDispatchType dispatch_type = std::get<3>(params); | 535 InputEventDispatchType dispatch_type = std::get<3>(params); |
| 535 | 536 |
| 536 EXPECT_EQ(kBlockingEvents[0].size(), event->size()); | 537 EXPECT_EQ(kBlockingEvents[0].size(), event->size()); |
| 537 EXPECT_TRUE(memcmp(&kBlockingEvents[0], event, event->size()) == 0); | 538 EXPECT_TRUE(memcmp(&kBlockingEvents[0], event, event->size()) == 0); |
| 538 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_BLOCKING, dispatch_type); | 539 EXPECT_EQ(InputEventDispatchType::DISPATCH_TYPE_BLOCKING, dispatch_type); |
| 539 } | 540 } |
| 540 } | 541 } |
| 541 | 542 |
| 542 } // namespace content | 543 } // namespace content |
| OLD | NEW |