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

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

Issue 2785883004: Add missing TaskScheduler on tests using RendereWidgetHostImpl (Closed)
Patch Set: yet another mac fix 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 "build/build_config.h" 17 #include "build/build_config.h"
17 #include "cc/surfaces/compositor_frame_sink_support.h" 18 #include "cc/surfaces/compositor_frame_sink_support.h"
18 #include "cc/surfaces/surface.h" 19 #include "cc/surfaces/surface.h"
19 #include "cc/surfaces/surface_factory.h" 20 #include "cc/surfaces/surface_factory.h"
20 #include "cc/surfaces/surface_manager.h" 21 #include "cc/surfaces/surface_manager.h"
21 #include "cc/surfaces/surface_sequence.h" 22 #include "cc/surfaces/surface_sequence.h"
22 #include "cc/test/begin_frame_args_test.h" 23 #include "cc/test/begin_frame_args_test.h"
23 #include "cc/test/fake_external_begin_frame_source.h" 24 #include "cc/test/fake_external_begin_frame_source.h"
24 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 25 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
25 #include "content/browser/frame_host/cross_process_frame_connector.h" 26 #include "content/browser/frame_host/cross_process_frame_connector.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return nullptr; 67 return nullptr;
67 } 68 }
68 69
69 cc::SurfaceInfo last_surface_info_; 70 cc::SurfaceInfo last_surface_info_;
70 }; 71 };
71 72
72 } // namespace 73 } // namespace
73 74
74 class RenderWidgetHostViewChildFrameTest : public testing::Test { 75 class RenderWidgetHostViewChildFrameTest : public testing::Test {
75 public: 76 public:
76 RenderWidgetHostViewChildFrameTest() {} 77 RenderWidgetHostViewChildFrameTest() : task_scheduler_(&message_loop_) {}
77 78
78 void SetUp() override { 79 void SetUp() override {
79 browser_context_.reset(new TestBrowserContext); 80 browser_context_.reset(new TestBrowserContext);
80 81
81 // ImageTransportFactory doesn't exist on Android. 82 // ImageTransportFactory doesn't exist on Android.
82 #if !defined(OS_ANDROID) 83 #if !defined(OS_ANDROID)
83 ImageTransportFactory::InitializeForUnitTests( 84 ImageTransportFactory::InitializeForUnitTests(
84 base::WrapUnique(new NoTransportImageTransportFactory)); 85 base::WrapUnique(new NoTransportImageTransportFactory));
85 #endif 86 #endif
86 87
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 cc::LocalSurfaceId GetLocalSurfaceId() const { 119 cc::LocalSurfaceId GetLocalSurfaceId() const {
119 return view_->local_surface_id_; 120 return view_->local_surface_id_;
120 } 121 }
121 122
122 void ClearCompositorSurfaceIfNecessary() { 123 void ClearCompositorSurfaceIfNecessary() {
123 view_->ClearCompositorSurfaceIfNecessary(); 124 view_->ClearCompositorSurfaceIfNecessary();
124 } 125 }
125 126
126 protected: 127 protected:
127 base::MessageLoopForUI message_loop_; 128 base::MessageLoopForUI message_loop_;
129
130 // TaskScheduler is used by RenderWidgetHostImpl constructor.
131 base::test::ScopedTaskScheduler task_scheduler_;
132
128 std::unique_ptr<BrowserContext> browser_context_; 133 std::unique_ptr<BrowserContext> browser_context_;
129 MockRenderWidgetHostDelegate delegate_; 134 MockRenderWidgetHostDelegate delegate_;
130 135
131 // Tests should set these to NULL if they've already triggered their 136 // Tests should set these to NULL if they've already triggered their
132 // destruction. 137 // destruction.
133 RenderWidgetHostImpl* widget_host_; 138 RenderWidgetHostImpl* widget_host_;
134 RenderWidgetHostViewChildFrame* view_; 139 RenderWidgetHostViewChildFrame* view_;
135 MockCrossProcessFrameConnector* test_frame_connector_; 140 MockCrossProcessFrameConnector* test_frame_connector_;
136 141
137 private: 142 private:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // Explicit ack through OnBeginFrameDidNotSwap is forwarded. 281 // Explicit ack through OnBeginFrameDidNotSwap is forwarded.
277 cc::BeginFrameAck ack(source_id, 6, 4, false); 282 cc::BeginFrameAck ack(source_id, 6, 4, false);
278 view_->OnBeginFrameDidNotSwap(ack); 283 view_->OnBeginFrameDidNotSwap(ack);
279 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); 284 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get()));
280 } 285 }
281 286
282 view_->SetNeedsBeginFrames(false); 287 view_->SetNeedsBeginFrames(false);
283 } 288 }
284 289
285 } // namespace content 290 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698