| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/renderer/mus/compositor_mus_connection.h" | 5 #include "content/renderer/mus/compositor_mus_connection.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/test/test_simple_task_runner.h" | 11 #include "base/test/test_simple_task_runner.h" |
| 13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 14 #include "components/mus/public/cpp/tests/test_window.h" | 13 #include "components/mus/public/cpp/tests/test_window.h" |
| 15 #include "components/mus/public/interfaces/input_event_constants.mojom.h" | 14 #include "components/mus/public/interfaces/input_event_constants.mojom.h" |
| 16 #include "components/mus/public/interfaces/input_events.mojom.h" | 15 #include "components/mus/public/interfaces/input_events.mojom.h" |
| 17 #include "components/mus/public/interfaces/input_key_codes.mojom.h" | 16 #include "components/mus/public/interfaces/input_key_codes.mojom.h" |
| 18 #include "content/common/input/did_overscroll_params.h" | 17 #include "content/common/input/did_overscroll_params.h" |
| 19 #include "content/common/input/input_event_ack.h" | 18 #include "content/common/input/input_event_ack.h" |
| 20 #include "content/common/input/input_event_ack_state.h" | 19 #include "content/common/input/input_event_ack_state.h" |
| 21 #include "content/public/test/mock_render_thread.h" | 20 #include "content/public/test/mock_render_thread.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 TestRenderWidgetInputHandler* input_handler = render_widget_input_handler(); | 461 TestRenderWidgetInputHandler* input_handler = render_widget_input_handler(); |
| 463 input_handler->set_delegate(connection()); | 462 input_handler->set_delegate(connection()); |
| 464 input_handler->set_state(InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED); | 463 input_handler->set_state(InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED); |
| 465 | 464 |
| 466 mus::TestWindow test_window; | 465 mus::TestWindow test_window; |
| 467 ui::PointerEvent event(ui::ET_POINTER_DOWN, | 466 ui::PointerEvent event(ui::ET_POINTER_DOWN, |
| 468 ui::EventPointerType::POINTER_TYPE_TOUCH, gfx::Point(), | 467 ui::EventPointerType::POINTER_TYPE_TOUCH, gfx::Point(), |
| 469 gfx::Point(), ui::EF_NONE, 0, ui::EventTimeForNow()); | 468 gfx::Point(), ui::EF_NONE, 0, ui::EventTimeForNow()); |
| 470 | 469 |
| 471 scoped_refptr<TestCallback> test_callback(new TestCallback); | 470 scoped_refptr<TestCallback> test_callback(new TestCallback); |
| 472 scoped_ptr<base::Callback<void(EventResult)>> ack_callback( | 471 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback( |
| 473 new base::Callback<void(EventResult)>( | 472 new base::Callback<void(EventResult)>( |
| 474 base::Bind(&::TestCallback::ResultCallback, test_callback))); | 473 base::Bind(&::TestCallback::ResultCallback, test_callback))); |
| 475 | 474 |
| 476 OnWindowInputEvent(&test_window, event, &ack_callback); | 475 OnWindowInputEvent(&test_window, event, &ack_callback); |
| 477 // OnWindowInputEvent is expected to clear the callback if it plans on | 476 // OnWindowInputEvent is expected to clear the callback if it plans on |
| 478 // handling the ack. | 477 // handling the ack. |
| 479 EXPECT_FALSE(ack_callback.get()); | 478 EXPECT_FALSE(ack_callback.get()); |
| 480 | 479 |
| 481 VerifyAndRunQueues(true, true); | 480 VerifyAndRunQueues(true, true); |
| 482 | 481 |
| 483 // The ack callback should have been called | 482 // The ack callback should have been called |
| 484 EXPECT_TRUE(test_callback->called()); | 483 EXPECT_TRUE(test_callback->called()); |
| 485 EXPECT_EQ(EventResult::HANDLED, test_callback->result()); | 484 EXPECT_EQ(EventResult::HANDLED, test_callback->result()); |
| 486 } | 485 } |
| 487 | 486 |
| 488 } // namespace content | 487 } // namespace content |
| OLD | NEW |