OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/common/text_input_state.h" | 27 #include "content/common/text_input_state.h" |
28 #include "content/common/view_messages.h" | 28 #include "content/common/view_messages.h" |
29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
30 #include "content/public/browser/render_widget_host_view_mac_delegate.h" | 30 #include "content/public/browser/render_widget_host_view_mac_delegate.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "content/public/test/mock_render_process_host.h" | 32 #include "content/public/test/mock_render_process_host.h" |
33 #include "content/public/test/test_browser_context.h" | 33 #include "content/public/test/test_browser_context.h" |
34 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
35 #include "content/test/test_render_view_host.h" | 35 #include "content/test/test_render_view_host.h" |
36 #include "gpu/ipc/common/gpu_messages.h" | 36 #include "gpu/ipc/common/gpu_messages.h" |
| 37 #include "gpu/ipc/service/image_transport_surface.h" |
37 #include "testing/gmock/include/gmock/gmock.h" | 38 #include "testing/gmock/include/gmock/gmock.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
39 #include "testing/gtest_mac.h" | 40 #include "testing/gtest_mac.h" |
40 #import "third_party/ocmock/OCMock/OCMock.h" | 41 #import "third_party/ocmock/OCMock/OCMock.h" |
41 #import "third_party/ocmock/ocmock_extensions.h" | 42 #import "third_party/ocmock/ocmock_extensions.h" |
42 #include "ui/events/base_event_utils.h" | 43 #include "ui/events/base_event_utils.h" |
43 #include "ui/events/blink/web_input_event_traits.h" | 44 #include "ui/events/blink/web_input_event_traits.h" |
44 #include "ui/events/latency_info.h" | 45 #include "ui/events/latency_info.h" |
45 #include "ui/events/test/cocoa_test_event_utils.h" | 46 #include "ui/events/test/cocoa_test_event_utils.h" |
46 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 47 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 public: | 248 public: |
248 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) { | 249 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) { |
249 std::unique_ptr<base::SimpleTestTickClock> mock_clock( | 250 std::unique_ptr<base::SimpleTestTickClock> mock_clock( |
250 new base::SimpleTestTickClock()); | 251 new base::SimpleTestTickClock()); |
251 mock_clock->Advance(base::TimeDelta::FromMilliseconds(100)); | 252 mock_clock->Advance(base::TimeDelta::FromMilliseconds(100)); |
252 ui::SetEventTickClockForTesting(std::move(mock_clock)); | 253 ui::SetEventTickClockForTesting(std::move(mock_clock)); |
253 } | 254 } |
254 | 255 |
255 void SetUp() override { | 256 void SetUp() override { |
256 RenderViewHostImplTestHarness::SetUp(); | 257 RenderViewHostImplTestHarness::SetUp(); |
| 258 gpu::ImageTransportSurface::SetAllowOSMesaForTesting(true); |
| 259 |
257 // TestRenderViewHost's destruction assumes that its view is a | 260 // TestRenderViewHost's destruction assumes that its view is a |
258 // TestRenderWidgetHostView, so store its view and reset it back to the | 261 // TestRenderWidgetHostView, so store its view and reset it back to the |
259 // stored view in |TearDown()|. | 262 // stored view in |TearDown()|. |
260 old_rwhv_ = rvh()->GetWidget()->GetView(); | 263 old_rwhv_ = rvh()->GetWidget()->GetView(); |
261 | 264 |
262 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. | 265 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. |
263 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); | 266 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); |
264 RenderWidgetHostImpl::From(rvh()->GetWidget())->SetView(rwhv_mac_); | 267 RenderWidgetHostImpl::From(rvh()->GetWidget())->SetView(rwhv_mac_); |
265 | 268 |
266 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); | 269 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 // Verify that this IPC is asking for no monitoring or immediate updates. | 1608 // Verify that this IPC is asking for no monitoring or immediate updates. |
1606 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, | 1609 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, |
1607 &child_msg_params); | 1610 &child_msg_params); |
1608 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); | 1611 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); |
1609 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); | 1612 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); |
1610 EXPECT_FALSE(is_child_msg_for_immediate_request); | 1613 EXPECT_FALSE(is_child_msg_for_immediate_request); |
1611 EXPECT_FALSE(is_child_msg_for_monitor_request); | 1614 EXPECT_FALSE(is_child_msg_for_monitor_request); |
1612 } | 1615 } |
1613 | 1616 |
1614 } // namespace content | 1617 } // namespace content |
OLD | NEW |