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

Unified Diff: cc/layers/texture_layer_unittest.cc

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. Created 5 years, 7 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/texture_layer_unittest.cc
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
index 3bd90ec5782195eeb21c197ace139f70057bdb83..b55a14d87424e9b69536a6378824d46e17c8b4a2 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -201,11 +201,12 @@ class TextureLayerTest : public testing::Test {
TestTaskGraphRunner task_graph_runner_;
FakeLayerTreeHostImpl host_impl_;
CommonMailboxObjects test_data_;
+ LayerSettings layer_settings_;
};
TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer));
// Test properties that should call SetNeedsCommit. All properties need to
@@ -225,7 +226,8 @@ TEST_F(TextureLayerTest, VisibleContentOpaqueRegion) {
const gfx::Rect layer_rect(layer_bounds);
const Region layer_region(layer_rect);
- scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(nullptr);
+ scoped_refptr<TextureLayer> layer =
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
layer->SetBounds(layer_bounds);
layer->draw_properties().visible_content_rect = layer_rect;
layer->SetBlendBackgroundColor(true);
@@ -249,8 +251,8 @@ TEST_F(TextureLayerTest, VisibleContentOpaqueRegion) {
TEST_F(TextureLayerTest, RateLimiter) {
FakeTextureLayerClient client;
- scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(
- &client);
+ scoped_refptr<TextureLayer> test_layer =
+ TextureLayer::CreateForMailbox(layer_settings_, &client);
test_layer->SetIsDrawable(true);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
layer_tree_host_->SetRootLayer(test_layer);
@@ -278,8 +280,7 @@ TEST_F(TextureLayerTest, RateLimiter) {
Mock::VerifyAndClearExpectations(layer_tree_host_.get());
// Reset to a layer with a client, that started the rate limiter.
- test_layer = TextureLayer::CreateForMailbox(
- &client);
+ test_layer = TextureLayer::CreateForMailbox(layer_settings_, &client);
test_layer->SetIsDrawable(true);
test_layer->SetRateLimitContext(true);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
@@ -319,7 +320,7 @@ class TextureLayerWithMailboxTest : public TextureLayerTest {
TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
@@ -377,7 +378,7 @@ TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) {
TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
// These use the same gpu::Mailbox, but different sync points.
@@ -457,7 +458,7 @@ class TextureLayerMailboxHolderTest : public TextureLayerTest {
TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
main_thread_.message_loop()->task_runner()->PostTask(
@@ -507,7 +508,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) {
TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
main_thread_.message_loop()->task_runner()->PostTask(
@@ -558,7 +559,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) {
TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
main_thread_.message_loop()->task_runner()->PostTask(
@@ -609,7 +610,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) {
TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_SecondImplRefShortcut) {
scoped_refptr<TextureLayer> test_layer =
- TextureLayer::CreateForMailbox(nullptr);
+ TextureLayer::CreateForMailbox(layer_settings_, nullptr);
ASSERT_TRUE(test_layer.get());
main_thread_.message_loop()->task_runner()->PostTask(
@@ -707,10 +708,10 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest {
EXPECT_EQ(true, main_thread_.CalledOnValidThread());
gfx::Size bounds(100, 100);
- root_ = Layer::Create();
+ root_ = Layer::Create(layer_settings());
root_->SetBounds(bounds);
- layer_ = TextureLayer::CreateForMailbox(nullptr);
+ layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
layer_->SetIsDrawable(true);
layer_->SetBounds(bounds);
@@ -828,10 +829,10 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
void BeginTest() override {
gfx::Size bounds(100, 100);
- root_ = Layer::Create();
+ root_ = Layer::Create(layer_settings());
root_->SetBounds(bounds);
- layer_ = TextureLayer::CreateForMailbox(nullptr);
+ layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
layer_->SetIsDrawable(true);
layer_->SetBounds(bounds);
@@ -1129,11 +1130,11 @@ class TextureLayerNoExtraCommitForMailboxTest
}
void SetupTree() override {
- scoped_refptr<Layer> root = Layer::Create();
+ scoped_refptr<Layer> root = Layer::Create(layer_settings());
root->SetBounds(gfx::Size(10, 10));
root->SetIsDrawable(true);
- texture_layer_ = TextureLayer::CreateForMailbox(this);
+ texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this);
texture_layer_->SetBounds(gfx::Size(10, 10));
texture_layer_->SetIsDrawable(true);
root->AddChild(texture_layer_);
@@ -1224,22 +1225,22 @@ class TextureLayerChangeInvisibleMailboxTest
}
void SetupTree() override {
- scoped_refptr<Layer> root = Layer::Create();
+ scoped_refptr<Layer> root = Layer::Create(layer_settings());
root->SetBounds(gfx::Size(10, 10));
root->SetIsDrawable(true);
- solid_layer_ = SolidColorLayer::Create();
+ solid_layer_ = SolidColorLayer::Create(layer_settings());
solid_layer_->SetBounds(gfx::Size(10, 10));
solid_layer_->SetIsDrawable(true);
solid_layer_->SetBackgroundColor(SK_ColorWHITE);
root->AddChild(solid_layer_);
- parent_layer_ = Layer::Create();
+ parent_layer_ = Layer::Create(layer_settings());
parent_layer_->SetBounds(gfx::Size(10, 10));
parent_layer_->SetIsDrawable(true);
root->AddChild(parent_layer_);
- texture_layer_ = TextureLayer::CreateForMailbox(this);
+ texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this);
texture_layer_->SetBounds(gfx::Size(10, 10));
texture_layer_->SetIsDrawable(true);
parent_layer_->AddChild(texture_layer_);
@@ -1354,7 +1355,7 @@ class TextureLayerReleaseResourcesBase
LayerTreeTest::SetupTree();
scoped_refptr<TextureLayer> texture_layer =
- TextureLayer::CreateForMailbox(this);
+ TextureLayer::CreateForMailbox(layer_settings(), this);
texture_layer->SetBounds(gfx::Size(10, 10));
texture_layer->SetIsDrawable(true);
@@ -1418,10 +1419,10 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest {
void SetupTree() override {
gfx::Size bounds(100, 100);
- root_ = Layer::Create();
+ root_ = Layer::Create(layer_settings());
root_->SetBounds(bounds);
- layer_ = TextureLayer::CreateForMailbox(nullptr);
+ layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
layer_->SetIsDrawable(true);
layer_->SetBounds(bounds);
@@ -1487,10 +1488,10 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest {
void SetupTree() override {
gfx::Size bounds(100, 100);
- root_ = Layer::Create();
+ root_ = Layer::Create(layer_settings());
root_->SetBounds(bounds);
- layer_ = TextureLayer::CreateForMailbox(nullptr);
+ layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
layer_->SetIsDrawable(true);
layer_->SetBounds(bounds);

Powered by Google App Engine
This is Rietveld 408576698