Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc

Issue 2800833005: Remove SurfaceFactory Occurrences Outside Of cc (Closed)
Patch Set: Cleanup Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/test/scoped_task_scheduler.h" 16 #include "base/test/scoped_task_scheduler.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "cc/surfaces/compositor_frame_sink_support.h" 18 #include "cc/surfaces/compositor_frame_sink_support.h"
19 #include "cc/surfaces/surface.h" 19 #include "cc/surfaces/surface.h"
20 #include "cc/surfaces/surface_factory.h"
21 #include "cc/surfaces/surface_manager.h" 20 #include "cc/surfaces/surface_manager.h"
22 #include "cc/surfaces/surface_sequence.h" 21 #include "cc/surfaces/surface_sequence.h"
23 #include "cc/test/begin_frame_args_test.h" 22 #include "cc/test/begin_frame_args_test.h"
24 #include "cc/test/fake_external_begin_frame_source.h" 23 #include "cc/test/fake_external_begin_frame_source.h"
25 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 24 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
26 #include "content/browser/frame_host/cross_process_frame_connector.h" 25 #include "content/browser/frame_host/cross_process_frame_connector.h"
27 #include "content/browser/gpu/compositor_util.h" 26 #include "content/browser/gpu/compositor_util.h"
28 #include "content/browser/renderer_host/render_widget_host_delegate.h" 27 #include "content/browser/renderer_host/render_widget_host_delegate.h"
29 #include "content/browser/renderer_host/render_widget_host_impl.h" 28 #include "content/browser/renderer_host/render_widget_host_impl.h"
30 #include "content/common/view_messages.h" 29 #include "content/common/view_messages.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 116 }
118 117
119 cc::LocalSurfaceId GetLocalSurfaceId() const { 118 cc::LocalSurfaceId GetLocalSurfaceId() const {
120 return view_->local_surface_id_; 119 return view_->local_surface_id_;
121 } 120 }
122 121
123 void ClearCompositorSurfaceIfNecessary() { 122 void ClearCompositorSurfaceIfNecessary() {
124 view_->ClearCompositorSurfaceIfNecessary(); 123 view_->ClearCompositorSurfaceIfNecessary();
125 } 124 }
126 125
126 void SetBeginFrameSourceForSupport(cc::BeginFrameSource* source) {
127 view_->support_->SetBeginFrameSource(source);
128 }
129
127 protected: 130 protected:
128 base::MessageLoopForUI message_loop_; 131 base::MessageLoopForUI message_loop_;
129 132
130 // TaskScheduler is used by RenderWidgetHostImpl constructor. 133 // TaskScheduler is used by RenderWidgetHostImpl constructor.
131 base::test::ScopedTaskScheduler task_scheduler_; 134 base::test::ScopedTaskScheduler task_scheduler_;
132 135
133 std::unique_ptr<BrowserContext> browser_context_; 136 std::unique_ptr<BrowserContext> browser_context_;
134 MockRenderWidgetHostDelegate delegate_; 137 MockRenderWidgetHostDelegate delegate_;
135 138
136 // Tests should set these to NULL if they've already triggered their 139 // Tests should set these to NULL if they've already triggered their
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 gfx::Size view_size(100, 100); 239 gfx::Size view_size(100, 100);
237 gfx::Rect view_rect(view_size); 240 gfx::Rect view_rect(view_size);
238 float scale_factor = 1.f; 241 float scale_factor = 1.f;
239 242
240 view_->SetSize(view_size); 243 view_->SetSize(view_size);
241 view_->Show(); 244 view_->Show();
242 245
243 // Replace BeginFrameSource so that we can observe acknowledgments. 246 // Replace BeginFrameSource so that we can observe acknowledgments.
244 cc::FakeExternalBeginFrameSource source(0.f, false); 247 cc::FakeExternalBeginFrameSource source(0.f, false);
245 uint32_t source_id = source.source_id(); 248 uint32_t source_id = source.source_id();
246 static_cast<cc::SurfaceFactoryClient*>(view_->support_.get()) 249 SetBeginFrameSourceForSupport(&source);
247 ->SetBeginFrameSource(&source);
248 view_->SetNeedsBeginFrames(true); 250 view_->SetNeedsBeginFrames(true);
249 251
250 { 252 {
251 cc::BeginFrameArgs args = 253 cc::BeginFrameArgs args =
252 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 5u); 254 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 5u);
253 source.TestOnBeginFrame(args); 255 source.TestOnBeginFrame(args);
254 256
255 // Ack from CompositorFrame is forwarded. 257 // Ack from CompositorFrame is forwarded.
256 cc::BeginFrameAck ack(source_id, 5, 4, true); 258 cc::BeginFrameAck ack(source_id, 5, 4, true);
257 cc::CompositorFrame frame = 259 cc::CompositorFrame frame =
(...skipping 11 matching lines...) Expand all
269 // Explicit ack through OnBeginFrameDidNotSwap is forwarded. 271 // Explicit ack through OnBeginFrameDidNotSwap is forwarded.
270 cc::BeginFrameAck ack(source_id, 6, 4, false); 272 cc::BeginFrameAck ack(source_id, 6, 4, false);
271 view_->OnBeginFrameDidNotSwap(ack); 273 view_->OnBeginFrameDidNotSwap(ack);
272 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); 274 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get()));
273 } 275 }
274 276
275 view_->SetNeedsBeginFrames(false); 277 view_->SetNeedsBeginFrames(false);
276 } 278 }
277 279
278 } // namespace content 280 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698