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

Side by Side Diff: cc/output/gl_renderer_unittest.cc

Issue 14092003: Add compositor support for the LatencyInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include "cc/output/compositor_frame_metadata.h" 7 #include "cc/output/compositor_frame_metadata.h"
8 #include "cc/resources/prioritized_resource_manager.h" 8 #include "cc/resources/prioritized_resource_manager.h"
9 #include "cc/resources/resource_provider.h" 9 #include "cc/resources/resource_provider.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 output_surface_(FakeOutputSurface::Create3d( 241 output_surface_(FakeOutputSurface::Create3d(
242 scoped_ptr<WebKit::WebGraphicsContext3D>( 242 scoped_ptr<WebKit::WebGraphicsContext3D>(
243 new FrameCountingMemoryAllocationSettingContext()))), 243 new FrameCountingMemoryAllocationSettingContext()))),
244 resource_provider_(ResourceProvider::Create(output_surface_.get(), 0)), 244 resource_provider_(ResourceProvider::Create(output_surface_.get(), 0)),
245 renderer_(&mock_client_, 245 renderer_(&mock_client_,
246 output_surface_.get(), 246 output_surface_.get(),
247 resource_provider_.get()) {} 247 resource_provider_.get()) {}
248 248
249 virtual void SetUp() { renderer_.Initialize(); } 249 virtual void SetUp() { renderer_.Initialize(); }
250 250
251 void SwapBuffers() { renderer_.SwapBuffers(); } 251 void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); }
252 252
253 FrameCountingMemoryAllocationSettingContext* context() { 253 FrameCountingMemoryAllocationSettingContext* context() {
254 return static_cast<FrameCountingMemoryAllocationSettingContext*>( 254 return static_cast<FrameCountingMemoryAllocationSettingContext*>(
255 output_surface_->context3d()); 255 output_surface_->context3d());
256 } 256 }
257 257
258 WebGraphicsMemoryAllocation suggest_have_backbuffer_yes_; 258 WebGraphicsMemoryAllocation suggest_have_backbuffer_yes_;
259 WebGraphicsMemoryAllocation suggest_have_backbuffer_no_; 259 WebGraphicsMemoryAllocation suggest_have_backbuffer_no_;
260 260
261 scoped_ptr<OutputSurface> output_surface_; 261 scoped_ptr<OutputSurface> output_surface_;
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 }; 1293 };
1294 1294
1295 class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { 1295 class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient {
1296 protected: 1296 protected:
1297 MockOutputSurfaceTest() 1297 MockOutputSurfaceTest()
1298 : resource_provider_(ResourceProvider::Create(&output_surface_, 0)), 1298 : resource_provider_(ResourceProvider::Create(&output_surface_, 0)),
1299 renderer_(this, &output_surface_, resource_provider_.get()) {} 1299 renderer_(this, &output_surface_, resource_provider_.get()) {}
1300 1300
1301 virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); } 1301 virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); }
1302 1302
1303 void SwapBuffers() { renderer_.SwapBuffers(); } 1303 void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); }
1304 1304
1305 void DrawFrame() { 1305 void DrawFrame() {
1306 gfx::Rect viewport_rect(DeviceViewportSize()); 1306 gfx::Rect viewport_rect(DeviceViewportSize());
1307 ScopedPtrVector<RenderPass>* render_passes = render_passes_in_draw_order(); 1307 ScopedPtrVector<RenderPass>* render_passes = render_passes_in_draw_order();
1308 render_passes->clear(); 1308 render_passes->clear();
1309 1309
1310 RenderPass::Id render_pass_id(1, 0); 1310 RenderPass::Id render_pass_id(1, 0);
1311 TestRenderPass* render_pass = AddRenderPass( 1311 TestRenderPass* render_pass = AddRenderPass(
1312 render_passes, render_pass_id, viewport_rect, gfx::Transform()); 1312 render_passes, render_pass_id, viewport_rect, gfx::Transform());
1313 AddQuad(render_pass, viewport_rect, SK_ColorGREEN); 1313 AddQuad(render_pass, viewport_rect, SK_ColorGREEN);
(...skipping 17 matching lines...) Expand all
1331 1331
1332 StrictMock<MockOutputSurface> output_surface_; 1332 StrictMock<MockOutputSurface> output_surface_;
1333 scoped_ptr<ResourceProvider> resource_provider_; 1333 scoped_ptr<ResourceProvider> resource_provider_;
1334 FakeRendererGL renderer_; 1334 FakeRendererGL renderer_;
1335 }; 1335 };
1336 1336
1337 TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) { 1337 TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) {
1338 DrawFrame(); 1338 DrawFrame();
1339 1339
1340 EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); 1340 EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
1341 renderer_.SwapBuffers(); 1341 renderer_.SwapBuffers(LatencyInfo());
1342 } 1342 }
1343 1343
1344 class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest { 1344 class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest {
1345 public: 1345 public:
1346 virtual const LayerTreeSettings& Settings() const OVERRIDE { 1346 virtual const LayerTreeSettings& Settings() const OVERRIDE {
1347 static LayerTreeSettings fake_settings; 1347 static LayerTreeSettings fake_settings;
1348 fake_settings.partial_swap_enabled = true; 1348 fake_settings.partial_swap_enabled = true;
1349 return fake_settings; 1349 return fake_settings;
1350 } 1350 }
1351 }; 1351 };
1352 1352
1353 TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) { 1353 TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) {
1354 DrawFrame(); 1354 DrawFrame();
1355 1355
1356 EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1); 1356 EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1);
1357 renderer_.SwapBuffers(); 1357 renderer_.SwapBuffers(LatencyInfo());
1358 } 1358 }
1359 1359
1360 class MockOutputSurfaceTestWithSendCompositorFrame 1360 class MockOutputSurfaceTestWithSendCompositorFrame
1361 : public MockOutputSurfaceTest { 1361 : public MockOutputSurfaceTest {
1362 public: 1362 public:
1363 virtual const LayerTreeSettings& Settings() const OVERRIDE { 1363 virtual const LayerTreeSettings& Settings() const OVERRIDE {
1364 static LayerTreeSettings fake_settings; 1364 static LayerTreeSettings fake_settings;
1365 fake_settings.compositor_frame_message = true; 1365 fake_settings.compositor_frame_message = true;
1366 return fake_settings; 1366 return fake_settings;
1367 } 1367 }
1368 }; 1368 };
1369 1369
1370 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) { 1370 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) {
1371 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1); 1371 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1);
1372 DrawFrame(); 1372 DrawFrame();
1373 } 1373 }
1374 1374
1375 } // namespace 1375 } // namespace
1376 } // namespace cc 1376 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698