| 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 "content/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
| 11 #include "cc/surfaces/surface_manager.h" | 11 #include "cc/surfaces/surface_manager.h" |
| 12 #include "cc/surfaces/surface_sequence.h" | 12 #include "cc/surfaces/surface_sequence.h" |
| 13 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 13 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| 14 #include "content/browser/frame_host/cross_process_frame_connector.h" | 14 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 15 #include "content/browser/gpu/compositor_util.h" | 15 #include "content/browser/gpu/compositor_util.h" |
| 16 #include "content/browser/gpu/gpu_surface_tracker.h" | |
| 17 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 16 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 19 #include "content/common/view_messages.h" | 18 #include "content/common/view_messages.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 19 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/test/mock_render_process_host.h" | 20 #include "content/public/test/mock_render_process_host.h" |
| 22 #include "content/public/test/test_browser_context.h" | 21 #include "content/public/test/test_browser_context.h" |
| 23 #include "content/test/test_render_view_host.h" | 22 #include "content/test/test_render_view_host.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 82 |
| 84 // ImageTransportFactory doesn't exist on Android. | 83 // ImageTransportFactory doesn't exist on Android. |
| 85 #if !defined(OS_ANDROID) | 84 #if !defined(OS_ANDROID) |
| 86 ImageTransportFactory::InitializeForUnitTests( | 85 ImageTransportFactory::InitializeForUnitTests( |
| 87 make_scoped_ptr(new NoTransportImageTransportFactory)); | 86 make_scoped_ptr(new NoTransportImageTransportFactory)); |
| 88 #endif | 87 #endif |
| 89 | 88 |
| 90 MockRenderProcessHost* process_host = | 89 MockRenderProcessHost* process_host = |
| 91 new MockRenderProcessHost(browser_context_.get()); | 90 new MockRenderProcessHost(browser_context_.get()); |
| 92 int32 routing_id = process_host->GetNextRoutingID(); | 91 int32 routing_id = process_host->GetNextRoutingID(); |
| 93 int32 surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 92 widget_host_ = |
| 94 process_host->GetID(), routing_id); | 93 new RenderWidgetHostImpl(&delegate_, process_host, routing_id, false); |
| 95 widget_host_ = new RenderWidgetHostImpl(&delegate_, process_host, | |
| 96 routing_id, surface_id, false); | |
| 97 view_ = new RenderWidgetHostViewChildFrame(widget_host_); | 94 view_ = new RenderWidgetHostViewChildFrame(widget_host_); |
| 98 | 95 |
| 99 test_frame_connector_ = new MockCrossProcessFrameConnector(); | 96 test_frame_connector_ = new MockCrossProcessFrameConnector(); |
| 100 view_->set_cross_process_frame_connector(test_frame_connector_); | 97 view_->set_cross_process_frame_connector(test_frame_connector_); |
| 101 } | 98 } |
| 102 | 99 |
| 103 void TearDown() override { | 100 void TearDown() override { |
| 104 if (view_) | 101 if (view_) |
| 105 view_->Destroy(); | 102 view_->Destroy(); |
| 106 delete widget_host_; | 103 delete widget_host_; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 test_frame_connector_->last_scale_factor_received_); | 184 test_frame_connector_->last_scale_factor_received_); |
| 188 } | 185 } |
| 189 } else { | 186 } else { |
| 190 EXPECT_TRUE(test_frame_connector_->received_delegated_frame_); | 187 EXPECT_TRUE(test_frame_connector_->received_delegated_frame_); |
| 191 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_); | 188 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_); |
| 192 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_); | 189 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_); |
| 193 } | 190 } |
| 194 } | 191 } |
| 195 | 192 |
| 196 } // namespace content | 193 } // namespace content |
| OLD | NEW |