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_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "build/build_config.h" |
10 #include "cc/surfaces/surface.h" | 13 #include "cc/surfaces/surface.h" |
11 #include "cc/surfaces/surface_factory.h" | 14 #include "cc/surfaces/surface_factory.h" |
12 #include "cc/surfaces/surface_manager.h" | 15 #include "cc/surfaces/surface_manager.h" |
13 #include "cc/surfaces/surface_sequence.h" | 16 #include "cc/surfaces/surface_sequence.h" |
14 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 17 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
15 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 18 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
16 #include "content/browser/gpu/compositor_util.h" | 19 #include "content/browser/gpu/compositor_util.h" |
17 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 20 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 21 #include "content/browser/renderer_host/render_widget_host_impl.h" |
19 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
(...skipping 26 matching lines...) Expand all Loading... |
46 | 49 |
47 void SetUp() override { | 50 void SetUp() override { |
48 #if !defined(OS_ANDROID) | 51 #if !defined(OS_ANDROID) |
49 ImageTransportFactory::InitializeForUnitTests( | 52 ImageTransportFactory::InitializeForUnitTests( |
50 scoped_ptr<ImageTransportFactory>( | 53 scoped_ptr<ImageTransportFactory>( |
51 new NoTransportImageTransportFactory)); | 54 new NoTransportImageTransportFactory)); |
52 #endif | 55 #endif |
53 browser_context_.reset(new TestBrowserContext); | 56 browser_context_.reset(new TestBrowserContext); |
54 MockRenderProcessHost* process_host = | 57 MockRenderProcessHost* process_host = |
55 new MockRenderProcessHost(browser_context_.get()); | 58 new MockRenderProcessHost(browser_context_.get()); |
56 int32 routing_id = process_host->GetNextRoutingID(); | 59 int32_t routing_id = process_host->GetNextRoutingID(); |
57 widget_host_ = | 60 widget_host_ = |
58 new RenderWidgetHostImpl(&delegate_, process_host, routing_id, false); | 61 new RenderWidgetHostImpl(&delegate_, process_host, routing_id, false); |
59 view_ = new RenderWidgetHostViewGuest( | 62 view_ = new RenderWidgetHostViewGuest( |
60 widget_host_, NULL, | 63 widget_host_, NULL, |
61 (new TestRenderWidgetHostView(widget_host_))->GetWeakPtr()); | 64 (new TestRenderWidgetHostView(widget_host_))->GetWeakPtr()); |
62 } | 65 } |
63 | 66 |
64 void TearDown() override { | 67 void TearDown() override { |
65 if (view_) | 68 if (view_) |
66 view_->Destroy(); | 69 view_->Destroy(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 #endif | 177 #endif |
175 browser_context_.reset(new TestBrowserContext); | 178 browser_context_.reset(new TestBrowserContext); |
176 MockRenderProcessHost* process_host = | 179 MockRenderProcessHost* process_host = |
177 new MockRenderProcessHost(browser_context_.get()); | 180 new MockRenderProcessHost(browser_context_.get()); |
178 web_contents_.reset( | 181 web_contents_.reset( |
179 TestWebContents::Create(browser_context_.get(), nullptr)); | 182 TestWebContents::Create(browser_context_.get(), nullptr)); |
180 // We don't own the BPG, the WebContents does. | 183 // We don't own the BPG, the WebContents does. |
181 browser_plugin_guest_ = new TestBrowserPluginGuest( | 184 browser_plugin_guest_ = new TestBrowserPluginGuest( |
182 web_contents_.get(), &browser_plugin_guest_delegate_); | 185 web_contents_.get(), &browser_plugin_guest_delegate_); |
183 | 186 |
184 int32 routing_id = process_host->GetNextRoutingID(); | 187 int32_t routing_id = process_host->GetNextRoutingID(); |
185 widget_host_ = | 188 widget_host_ = |
186 new RenderWidgetHostImpl(&delegate_, process_host, routing_id, false); | 189 new RenderWidgetHostImpl(&delegate_, process_host, routing_id, false); |
187 view_ = new RenderWidgetHostViewGuest( | 190 view_ = new RenderWidgetHostViewGuest( |
188 widget_host_, browser_plugin_guest_, | 191 widget_host_, browser_plugin_guest_, |
189 (new TestRenderWidgetHostView(widget_host_))->GetWeakPtr()); | 192 (new TestRenderWidgetHostView(widget_host_))->GetWeakPtr()); |
190 } | 193 } |
191 | 194 |
192 void TearDown() override { | 195 void TearDown() override { |
193 if (view_) | 196 if (view_) |
194 view_->Destroy(); | 197 view_->Destroy(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 browser_plugin_guest_->set_attached(false); | 315 browser_plugin_guest_->set_attached(false); |
313 browser_plugin_guest_->ResetTestData(); | 316 browser_plugin_guest_->ResetTestData(); |
314 | 317 |
315 view_->OnSwapCompositorFrame( | 318 view_->OnSwapCompositorFrame( |
316 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 319 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
317 if (UseSurfacesEnabled()) | 320 if (UseSurfacesEnabled()) |
318 EXPECT_TRUE(surface_id().is_null()); | 321 EXPECT_TRUE(surface_id().is_null()); |
319 } | 322 } |
320 | 323 |
321 } // namespace content | 324 } // namespace content |
OLD | NEW |