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

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
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 output_surface_(FakeOutputSurface::Create3d( 239 output_surface_(FakeOutputSurface::Create3d(
240 scoped_ptr<WebKit::WebGraphicsContext3D>( 240 scoped_ptr<WebKit::WebGraphicsContext3D>(
241 new FrameCountingMemoryAllocationSettingContext()))), 241 new FrameCountingMemoryAllocationSettingContext()))),
242 resource_provider_(ResourceProvider::Create(output_surface_.get(), 0)), 242 resource_provider_(ResourceProvider::Create(output_surface_.get(), 0)),
243 renderer_(&mock_client_, 243 renderer_(&mock_client_,
244 output_surface_.get(), 244 output_surface_.get(),
245 resource_provider_.get()) {} 245 resource_provider_.get()) {}
246 246
247 virtual void SetUp() { renderer_.Initialize(); } 247 virtual void SetUp() { renderer_.Initialize(); }
248 248
249 void SwapBuffers() { renderer_.SwapBuffers(); } 249 void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); }
250 250
251 FrameCountingMemoryAllocationSettingContext* Context() { 251 FrameCountingMemoryAllocationSettingContext* Context() {
252 return static_cast<FrameCountingMemoryAllocationSettingContext*>( 252 return static_cast<FrameCountingMemoryAllocationSettingContext*>(
253 output_surface_->context3d()); 253 output_surface_->context3d());
254 } 254 }
255 255
256 WebGraphicsMemoryAllocation suggest_have_backbuffer_yes_; 256 WebGraphicsMemoryAllocation suggest_have_backbuffer_yes_;
257 WebGraphicsMemoryAllocation suggest_have_backbuffer_no_; 257 WebGraphicsMemoryAllocation suggest_have_backbuffer_no_;
258 258
259 scoped_ptr<OutputSurface> output_surface_; 259 scoped_ptr<OutputSurface> output_surface_;
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 }; 1313 };
1314 1314
1315 class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { 1315 class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient {
1316 protected: 1316 protected:
1317 MockOutputSurfaceTest() 1317 MockOutputSurfaceTest()
1318 : resource_provider_(ResourceProvider::Create(&output_surface_, 0)), 1318 : resource_provider_(ResourceProvider::Create(&output_surface_, 0)),
1319 renderer_(this, &output_surface_, resource_provider_.get()) {} 1319 renderer_(this, &output_surface_, resource_provider_.get()) {}
1320 1320
1321 virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); } 1321 virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); }
1322 1322
1323 void SwapBuffers() { renderer_.SwapBuffers(); } 1323 void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); }
1324 1324
1325 void DrawFrame() { 1325 void DrawFrame() {
1326 gfx::Rect viewport_rect(DeviceViewportSize()); 1326 gfx::Rect viewport_rect(DeviceViewportSize());
1327 ScopedPtrVector<RenderPass>* render_passes = render_passes_in_draw_order(); 1327 ScopedPtrVector<RenderPass>* render_passes = render_passes_in_draw_order();
1328 render_passes->clear(); 1328 render_passes->clear();
1329 1329
1330 RenderPass::Id render_pass_id(1, 0); 1330 RenderPass::Id render_pass_id(1, 0);
1331 TestRenderPass* render_pass = AddRenderPass( 1331 TestRenderPass* render_pass = AddRenderPass(
1332 render_passes, render_pass_id, viewport_rect, gfx::Transform()); 1332 render_passes, render_pass_id, viewport_rect, gfx::Transform());
1333 AddQuad(render_pass, viewport_rect, SK_ColorGREEN); 1333 AddQuad(render_pass, viewport_rect, SK_ColorGREEN);
(...skipping 17 matching lines...) Expand all
1351 1351
1352 StrictMock<MockOutputSurface> output_surface_; 1352 StrictMock<MockOutputSurface> output_surface_;
1353 scoped_ptr<ResourceProvider> resource_provider_; 1353 scoped_ptr<ResourceProvider> resource_provider_;
1354 FakeRendererGL renderer_; 1354 FakeRendererGL renderer_;
1355 }; 1355 };
1356 1356
1357 TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) { 1357 TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) {
1358 DrawFrame(); 1358 DrawFrame();
1359 1359
1360 EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); 1360 EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
1361 renderer_.SwapBuffers(); 1361 renderer_.SwapBuffers(LatencyInfo());
1362 } 1362 }
1363 1363
1364 class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest { 1364 class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest {
1365 public: 1365 public:
1366 virtual const LayerTreeSettings& Settings() const OVERRIDE { 1366 virtual const LayerTreeSettings& Settings() const OVERRIDE {
1367 static LayerTreeSettings fake_settings; 1367 static LayerTreeSettings fake_settings;
1368 fake_settings.partial_swap_enabled = true; 1368 fake_settings.partial_swap_enabled = true;
1369 return fake_settings; 1369 return fake_settings;
1370 } 1370 }
1371 }; 1371 };
1372 1372
1373 TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) { 1373 TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) {
1374 DrawFrame(); 1374 DrawFrame();
1375 1375
1376 EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1); 1376 EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1);
1377 renderer_.SwapBuffers(); 1377 renderer_.SwapBuffers(LatencyInfo());
1378 } 1378 }
1379 1379
1380 class MockOutputSurfaceTestWithSendCompositorFrame 1380 class MockOutputSurfaceTestWithSendCompositorFrame
1381 : public MockOutputSurfaceTest { 1381 : public MockOutputSurfaceTest {
1382 public: 1382 public:
1383 virtual const LayerTreeSettings& Settings() const OVERRIDE { 1383 virtual const LayerTreeSettings& Settings() const OVERRIDE {
1384 static LayerTreeSettings fake_settings; 1384 static LayerTreeSettings fake_settings;
1385 fake_settings.compositor_frame_message = true; 1385 fake_settings.compositor_frame_message = true;
1386 return fake_settings; 1386 return fake_settings;
1387 } 1387 }
1388 }; 1388 };
1389 1389
1390 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) { 1390 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) {
1391 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1); 1391 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1);
1392 DrawFrame(); 1392 DrawFrame();
1393 } 1393 }
1394 1394
1395 } // namespace 1395 } // namespace
1396 } // namespace cc 1396 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698