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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test code refactor 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 70face09ca7790c622e8c82dd4ac278ce3295291..21eeddea15807ccffbd963df996d88ab6c7ecb7e 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4326,14 +4326,20 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
host->SetRootLayer(layer);
RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
- int frame_number = 0;
-
client.set_fill_with_nonsolid_color(!test_for_solid);
Region invalidation(layer_rect);
+
+ gfx::Rect new_recorded_viewport = client.PaintableRegion();
+ scoped_refptr<DisplayItemList> display_list =
+ client.PaintContentsToDisplayList(
+ ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ size_t painter_reported_memory_usage =
+ client.GetApproximateUnsharedMemoryUsage();
+
recording_source->UpdateAndExpandInvalidation(
vmpstr 2016/07/27 18:18:37 I think it's worth to create a helper function her
Menglin 2016/07/27 19:17:48 yeah i agree
Menglin 2016/07/29 23:50:14 Done.
- &client, &invalidation, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+ &client, &invalidation, layer_bounds, new_recorded_viewport, display_list,
+ painter_reported_memory_usage);
scoped_refptr<RasterSource> pending_raster_source =
recording_source->CreateRasterSource(true);
@@ -4389,15 +4395,20 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
host->SetRootLayer(layer);
RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
- int frame_number = 0;
-
client.set_fill_with_nonsolid_color(true);
recording_source->SetNeedsDisplayRect(layer_rect);
Region invalidation1;
+
+ gfx::Rect new_recorded_viewport = client.PaintableRegion();
+ scoped_refptr<DisplayItemList> display_list =
+ client.PaintContentsToDisplayList(
+ ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ size_t painter_reported_memory_usage =
+ client.GetApproximateUnsharedMemoryUsage();
recording_source->UpdateAndExpandInvalidation(
- &client, &invalidation1, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+ &client, &invalidation1, layer_bounds, new_recorded_viewport,
+ display_list, painter_reported_memory_usage);
scoped_refptr<RasterSource> raster_source1 =
recording_source->CreateRasterSource(true);
@@ -4415,9 +4426,15 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
recording_source->SetNeedsDisplayRect(layer_rect);
Region invalidation2;
+
+ new_recorded_viewport = client.PaintableRegion();
+ display_list = client.PaintContentsToDisplayList(
+ ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ painter_reported_memory_usage = client.GetApproximateUnsharedMemoryUsage();
+
recording_source->UpdateAndExpandInvalidation(
- &client, &invalidation2, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+ &client, &invalidation2, layer_bounds, new_recorded_viewport,
+ display_list, painter_reported_memory_usage);
scoped_refptr<RasterSource> raster_source2 =
recording_source->CreateRasterSource(true);

Powered by Google App Engine
This is Rietveld 408576698