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

Unified Diff: cc/layers/picture_layer_unittest.cc

Issue 2738613006: Remove non-leaky LazyInstances in cc. (Closed)
Patch Set: cc-remove-non-leaky-singletons: globals Created 3 years, 9 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
« no previous file with comments | « cc/layers/empty_content_layer_client.cc ('k') | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_unittest.cc
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc
index c151267bde915fabc4cf4a6f2ea78e37c20b2c18..5ae3b665881609f2cb3593cb16ca00036fb52908 100644
--- a/cc/layers/picture_layer_unittest.cc
+++ b/cc/layers/picture_layer_unittest.cc
@@ -11,10 +11,10 @@
#include "cc/animation/animation_host.h"
#include "cc/layers/append_quads_data.h"
#include "cc/layers/content_layer_client.h"
-#include "cc/layers/empty_content_layer_client.h"
#include "cc/layers/picture_layer_impl.h"
#include "cc/paint/paint_flags.h"
#include "cc/test/fake_compositor_frame_sink.h"
+#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/fake_picture_layer_impl.h"
@@ -34,8 +34,9 @@ namespace cc {
namespace {
TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
- ContentLayerClient* client = EmptyContentLayerClient::GetInstance();
- scoped_refptr<PictureLayer> layer = PictureLayer::Create(client);
+ FakeContentLayerClient client;
+ client.set_bounds(gfx::Size());
+ scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
layer->SetBounds(gfx::Size(10, 10));
FakeLayerTreeHostClient host_client;
@@ -247,10 +248,11 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) {
new FakeRecordingSource);
FakeRecordingSource* recording_source = recording_source_owned.get();
- ContentLayerClient* client = EmptyContentLayerClient::GetInstance();
+ FakeContentLayerClient client;
+ client.set_bounds(gfx::Size());
scoped_refptr<FakePictureLayer> layer =
FakePictureLayer::CreateWithRecordingSource(
- client, std::move(recording_source_owned));
+ &client, std::move(recording_source_owned));
FakeLayerTreeHostClient host_client;
TestTaskGraphRunner task_graph_runner;
@@ -264,12 +266,12 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) {
gfx::Rect layer_rect(layer_bounds);
Region invalidation(layer_rect);
- gfx::Rect new_recorded_viewport = client->PaintableRegion();
+ gfx::Rect new_recorded_viewport = client.PaintableRegion();
scoped_refptr<DisplayItemList> display_list =
- client->PaintContentsToDisplayList(
+ client.PaintContentsToDisplayList(
ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
size_t painter_reported_memory_usage =
- client->GetApproximateUnsharedMemoryUsage();
+ client.GetApproximateUnsharedMemoryUsage();
recording_source->UpdateAndExpandInvalidation(&invalidation, layer_bounds,
new_recorded_viewport);
recording_source->UpdateDisplayItemList(display_list,
@@ -297,8 +299,9 @@ TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) {
FakeLayerTreeHostClient host_client2;
TestTaskGraphRunner task_graph_runner;
- ContentLayerClient* client = EmptyContentLayerClient::GetInstance();
- scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client);
+ FakeContentLayerClient client;
+ client.set_bounds(gfx::Size());
+ scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client);
auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN);
« no previous file with comments | « cc/layers/empty_content_layer_client.cc ('k') | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698