| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/events/blink/did_overscroll_params.h" | 26 #include "ui/events/blink/did_overscroll_params.h" |
| 27 #include "ui/events/event_utils.h" | 27 #include "ui/events/event_utils.h" |
| 28 #include "ui/events/mojo/event.mojom.h" | 28 #include "ui/events/mojo/event.mojom.h" |
| 29 #include "ui/events/mojo/event_constants.mojom.h" | 29 #include "ui/events/mojo/event_constants.mojom.h" |
| 30 #include "ui/events/mojo/keyboard_codes.mojom.h" | 30 #include "ui/events/mojo/keyboard_codes.mojom.h" |
| 31 | 31 |
| 32 using ui::mojom::EventResult; | 32 using ui::mojom::EventResult; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 constexpr cc::FrameSinkId kArbitraryFrameSinkId(0, 1); |
| 37 |
| 36 // Wrapper for the callback provided to | 38 // Wrapper for the callback provided to |
| 37 // CompositorMusConnection:OnWindowInputEvent. This tracks whether the it was | 39 // CompositorMusConnection:OnWindowInputEvent. This tracks whether the it was |
| 38 // called, along with the result. | 40 // called, along with the result. |
| 39 class TestCallback : public base::RefCounted<TestCallback> { | 41 class TestCallback : public base::RefCounted<TestCallback> { |
| 40 public: | 42 public: |
| 41 TestCallback() : called_(false), result_(EventResult::UNHANDLED) {} | 43 TestCallback() : called_(false), result_(EventResult::UNHANDLED) {} |
| 42 | 44 |
| 43 bool called() { return called_; } | 45 bool called() { return called_; } |
| 44 EventResult result() { return result_; } | 46 EventResult result() { return result_; } |
| 45 | 47 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 DISALLOW_COPY_AND_ASSIGN(TestInputHandlerManagerClient); | 150 DISALLOW_COPY_AND_ASSIGN(TestInputHandlerManagerClient); |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 // Implementation of RenderWidget for testing, performs no initialization. | 153 // Implementation of RenderWidget for testing, performs no initialization. |
| 152 class TestRenderWidget : public content::RenderWidget { | 154 class TestRenderWidget : public content::RenderWidget { |
| 153 public: | 155 public: |
| 154 explicit TestRenderWidget(content::CompositorDependencies* compositor_deps) | 156 explicit TestRenderWidget(content::CompositorDependencies* compositor_deps) |
| 155 : content::RenderWidget(compositor_deps, | 157 : content::RenderWidget(compositor_deps, |
| 156 blink::WebPopupTypeNone, | 158 blink::WebPopupTypeNone, |
| 157 content::ScreenInfo(), | 159 content::ScreenInfo(), |
| 160 kArbitraryFrameSinkId, |
| 158 true, | 161 true, |
| 159 false, | 162 false, |
| 160 false) {} | 163 false) {} |
| 161 | 164 |
| 162 protected: | 165 protected: |
| 163 ~TestRenderWidget() override {} | 166 ~TestRenderWidget() override {} |
| 164 | 167 |
| 165 private: | 168 private: |
| 166 DISALLOW_COPY_AND_ASSIGN(TestRenderWidget); | 169 DISALLOW_COPY_AND_ASSIGN(TestRenderWidget); |
| 167 }; | 170 }; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 EXPECT_FALSE(ack_callback.get()); | 498 EXPECT_FALSE(ack_callback.get()); |
| 496 | 499 |
| 497 VerifyAndRunQueues(true, true); | 500 VerifyAndRunQueues(true, true); |
| 498 | 501 |
| 499 // The ack callback should have been called | 502 // The ack callback should have been called |
| 500 EXPECT_TRUE(test_callback->called()); | 503 EXPECT_TRUE(test_callback->called()); |
| 501 EXPECT_EQ(EventResult::HANDLED, test_callback->result()); | 504 EXPECT_EQ(EventResult::HANDLED, test_callback->result()); |
| 502 } | 505 } |
| 503 | 506 |
| 504 } // namespace content | 507 } // namespace content |
| OLD | NEW |