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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: no-constructor Created 4 years, 5 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
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/layers/picture_layer_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 pending_layer()->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1443 pending_layer()->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1444 EXPECT_EQ(gfx::Size(256, 256).ToString(), 1444 EXPECT_EQ(gfx::Size(256, 256).ToString(),
1445 tile->content_rect().size().ToString()); 1445 tile->content_rect().size().ToString());
1446 1446
1447 ResetTilingsAndRasterScales(); 1447 ResetTilingsAndRasterScales();
1448 1448
1449 // Change the max texture size on the output surface context. 1449 // Change the max texture size on the output surface context.
1450 std::unique_ptr<TestWebGraphicsContext3D> context = 1450 std::unique_ptr<TestWebGraphicsContext3D> context =
1451 TestWebGraphicsContext3D::Create(); 1451 TestWebGraphicsContext3D::Create();
1452 context->set_max_texture_size(140); 1452 context->set_max_texture_size(140);
1453 ResetOutputSurface(FakeOutputSurface::Create3d(std::move(context))); 1453 ResetOutputSurface(FakeOutputSurface::CreateDelegating3d(std::move(context)));
1454 1454
1455 SetupDrawPropertiesAndUpdateTiles(pending_layer(), 1.f, 1.f, 1.f, 1.f, 0.f, 1455 SetupDrawPropertiesAndUpdateTiles(pending_layer(), 1.f, 1.f, 1.f, 1.f, 0.f,
1456 false); 1456 false);
1457 ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); 1457 ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
1458 1458
1459 pending_layer()->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1459 pending_layer()->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1460 1460
1461 // Verify the tiles are not larger than the context's max texture size. 1461 // Verify the tiles are not larger than the context's max texture size.
1462 tile = pending_layer()->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1462 tile = pending_layer()->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1463 EXPECT_GE(140, tile->content_rect().width()); 1463 EXPECT_GE(140, tile->content_rect().width());
(...skipping 14 matching lines...) Expand all
1478 // There should be a single tile since the layer is small. 1478 // There should be a single tile since the layer is small.
1479 PictureLayerTiling* high_res_tiling = active_layer()->tilings()->tiling_at(0); 1479 PictureLayerTiling* high_res_tiling = active_layer()->tilings()->tiling_at(0);
1480 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); 1480 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size());
1481 1481
1482 ResetTilingsAndRasterScales(); 1482 ResetTilingsAndRasterScales();
1483 1483
1484 // Change the max texture size on the output surface context. 1484 // Change the max texture size on the output surface context.
1485 std::unique_ptr<TestWebGraphicsContext3D> context = 1485 std::unique_ptr<TestWebGraphicsContext3D> context =
1486 TestWebGraphicsContext3D::Create(); 1486 TestWebGraphicsContext3D::Create();
1487 context->set_max_texture_size(140); 1487 context->set_max_texture_size(140);
1488 ResetOutputSurface(FakeOutputSurface::Create3d(std::move(context))); 1488 ResetOutputSurface(FakeOutputSurface::CreateDelegating3d(std::move(context)));
1489 1489
1490 SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.f, 1.f, 1.f, 1.f, 0.f, 1490 SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.f, 1.f, 1.f, 1.f, 0.f,
1491 false); 1491 false);
1492 ASSERT_LE(1u, active_layer()->tilings()->num_tilings()); 1492 ASSERT_LE(1u, active_layer()->tilings()->num_tilings());
1493 1493
1494 active_layer()->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1494 active_layer()->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1495 1495
1496 // There should be more than one tile since the max texture size won't cover 1496 // There should be more than one tile since the max texture size won't cover
1497 // the layer. 1497 // the layer.
1498 high_res_tiling = active_layer()->tilings()->tiling_at(0); 1498 high_res_tiling = active_layer()->tilings()->tiling_at(0);
(...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { 4310 void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
4311 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4311 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4312 4312
4313 gfx::Size tile_size(100, 100); 4313 gfx::Size tile_size(100, 100);
4314 gfx::Size layer_bounds(200, 200); 4314 gfx::Size layer_bounds(200, 200);
4315 gfx::Rect layer_rect(layer_bounds); 4315 gfx::Rect layer_rect(layer_bounds);
4316 4316
4317 FakeContentLayerClient client; 4317 FakeContentLayerClient client;
4318 client.set_bounds(layer_bounds); 4318 client.set_bounds(layer_bounds);
4319 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 4319 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
4320 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); 4320 FakeLayerTreeHostClient host_client;
4321 TestTaskGraphRunner task_graph_runner; 4321 TestTaskGraphRunner task_graph_runner;
4322 std::unique_ptr<FakeLayerTreeHost> host = 4322 std::unique_ptr<FakeLayerTreeHost> host =
4323 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); 4323 FakeLayerTreeHost::Create(&host_client, &task_graph_runner);
4324 host->SetRootLayer(layer); 4324 host->SetRootLayer(layer);
4325 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 4325 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
4326 4326
4327 int frame_number = 0; 4327 int frame_number = 0;
4328 4328
4329 client.set_fill_with_nonsolid_color(!test_for_solid); 4329 client.set_fill_with_nonsolid_color(!test_for_solid);
4330 4330
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { 4373 TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
4374 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4374 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4375 4375
4376 gfx::Size tile_size(100, 100); 4376 gfx::Size tile_size(100, 100);
4377 gfx::Size layer_bounds(200, 200); 4377 gfx::Size layer_bounds(200, 200);
4378 gfx::Rect layer_rect(layer_bounds); 4378 gfx::Rect layer_rect(layer_bounds);
4379 4379
4380 FakeContentLayerClient client; 4380 FakeContentLayerClient client;
4381 client.set_bounds(layer_bounds); 4381 client.set_bounds(layer_bounds);
4382 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 4382 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
4383 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); 4383 FakeLayerTreeHostClient host_client;
4384 TestTaskGraphRunner task_graph_runner; 4384 TestTaskGraphRunner task_graph_runner;
4385 std::unique_ptr<FakeLayerTreeHost> host = 4385 std::unique_ptr<FakeLayerTreeHost> host =
4386 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); 4386 FakeLayerTreeHost::Create(&host_client, &task_graph_runner);
4387 host->SetRootLayer(layer); 4387 host->SetRootLayer(layer);
4388 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 4388 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
4389 4389
4390 int frame_number = 0; 4390 int frame_number = 0;
4391 4391
4392 client.set_fill_with_nonsolid_color(true); 4392 client.set_fill_with_nonsolid_color(true);
4393 4393
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
5001 EXPECT_FLOAT_EQ(expected_contents_scale, 5001 EXPECT_FLOAT_EQ(expected_contents_scale,
5002 pending_layer_ptr->picture_layer_tiling_set() 5002 pending_layer_ptr->picture_layer_tiling_set()
5003 ->FindTilingWithResolution(HIGH_RESOLUTION) 5003 ->FindTilingWithResolution(HIGH_RESOLUTION)
5004 ->contents_scale()) 5004 ->contents_scale())
5005 << "ideal_contents_scale: " << ideal_contents_scale; 5005 << "ideal_contents_scale: " << ideal_contents_scale;
5006 } 5006 }
5007 } 5007 }
5008 5008
5009 } // namespace 5009 } // namespace
5010 } // namespace cc 5010 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698