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

Side by Side Diff: content/browser/compositor/reflector_impl_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/message_loop/message_loop.h"
5 #include "base/run_loop.h" 6 #include "base/run_loop.h"
6 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
7 #include "cc/test/fake_output_surface_client.h" 8 #include "cc/test/fake_output_surface_client.h"
8 #include "cc/test/test_context_provider.h" 9 #include "cc/test/test_context_provider.h"
9 #include "cc/test/test_web_graphics_context_3d.h" 10 #include "cc/test/test_web_graphics_context_3d.h"
10 #include "content/browser/compositor/browser_compositor_output_surface.h" 11 #include "content/browser/compositor/browser_compositor_output_surface.h"
11 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" 12 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h"
12 #include "content/browser/compositor/reflector_impl.h" 13 #include "content/browser/compositor/reflector_impl.h"
13 #include "content/browser/compositor/reflector_texture.h" 14 #include "content/browser/compositor/reflector_texture.h"
14 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 15 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 class ReflectorImplTest : public testing::Test { 112 class ReflectorImplTest : public testing::Test {
112 public: 113 public:
113 void SetUp() override { 114 void SetUp() override {
114 bool enable_pixel_output = false; 115 bool enable_pixel_output = false;
115 ui::ContextFactory* context_factory = 116 ui::ContextFactory* context_factory =
116 ui::InitializeContextFactoryForTests(enable_pixel_output); 117 ui::InitializeContextFactoryForTests(enable_pixel_output);
117 ImageTransportFactory::InitializeForUnitTests( 118 ImageTransportFactory::InitializeForUnitTests(
118 scoped_ptr<ImageTransportFactory>( 119 scoped_ptr<ImageTransportFactory>(
119 new NoTransportImageTransportFactory)); 120 new NoTransportImageTransportFactory));
120 message_loop_.reset(new base::MessageLoop()); 121 message_loop_.reset(new base::MessageLoop());
121 task_runner_ = message_loop_->task_runner(); 122 proxy_ = message_loop_->message_loop_proxy();
122 compositor_task_runner_ = new FakeTaskRunner(); 123 compositor_task_runner_ = new FakeTaskRunner();
123 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, 124 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget,
124 context_factory, 125 context_factory,
125 compositor_task_runner_.get())); 126 compositor_task_runner_.get()));
126 context_provider_ = cc::TestContextProvider::Create( 127 context_provider_ = cc::TestContextProvider::Create(
127 cc::TestWebGraphicsContext3D::Create().Pass()); 128 cc::TestWebGraphicsContext3D::Create().Pass());
128 output_surface_ = 129 output_surface_ =
129 scoped_ptr<TestOutputSurface>( 130 scoped_ptr<TestOutputSurface>(
130 new TestOutputSurface(context_provider_, 131 new TestOutputSurface(context_provider_,
131 compositor_->vsync_manager())).Pass(); 132 compositor_->vsync_manager())).Pass();
(...skipping 26 matching lines...) Expand all
158 ImageTransportFactory::Terminate(); 159 ImageTransportFactory::Terminate();
159 } 160 }
160 161
161 void UpdateTexture() { reflector_->OnSourcePostSubBuffer(kSubRect); } 162 void UpdateTexture() { reflector_->OnSourcePostSubBuffer(kSubRect); }
162 163
163 protected: 164 protected:
164 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 165 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
165 scoped_refptr<cc::ContextProvider> context_provider_; 166 scoped_refptr<cc::ContextProvider> context_provider_;
166 cc::FakeOutputSurfaceClient output_surface_client_; 167 cc::FakeOutputSurfaceClient output_surface_client_;
167 scoped_ptr<base::MessageLoop> message_loop_; 168 scoped_ptr<base::MessageLoop> message_loop_;
168 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 169 scoped_refptr<base::MessageLoopProxy> proxy_;
169 scoped_ptr<ui::Compositor> compositor_; 170 scoped_ptr<ui::Compositor> compositor_;
170 scoped_ptr<ui::Layer> root_layer_; 171 scoped_ptr<ui::Layer> root_layer_;
171 scoped_ptr<ui::Layer> mirroring_layer_; 172 scoped_ptr<ui::Layer> mirroring_layer_;
172 scoped_ptr<ReflectorImpl> reflector_; 173 scoped_ptr<ReflectorImpl> reflector_;
173 scoped_ptr<TestOutputSurface> output_surface_; 174 scoped_ptr<TestOutputSurface> output_surface_;
174 }; 175 };
175 176
176 namespace { 177 namespace {
177 TEST_F(ReflectorImplTest, CheckNormalOutputSurface) { 178 TEST_F(ReflectorImplTest, CheckNormalOutputSurface) {
178 output_surface_->SetFlip(false); 179 output_surface_->SetFlip(false);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 plane_2.plane_z_order = 1; 214 plane_2.plane_z_order = 1;
214 list.push_back(plane_1); 215 list.push_back(plane_1);
215 list.push_back(plane_2); 216 list.push_back(plane_2);
216 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); 217 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list);
217 EXPECT_FALSE(list[0].overlay_handled); 218 EXPECT_FALSE(list[0].overlay_handled);
218 } 219 }
219 #endif // defined(USE_OZONE) 220 #endif // defined(USE_OZONE)
220 221
221 } // namespace 222 } // namespace
222 } // namespace content 223 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/reflector_impl.h ('k') | content/browser/compositor/software_browser_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698