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

Unified Diff: cc/layers/ui_resource_layer_unittest.cc

Issue 664173002: Prevent recreation of UI resource holder when created with resource ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed NeedsRecreation Created 6 years, 1 month 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/ui_resource_layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/ui_resource_layer_unittest.cc
diff --git a/cc/layers/ui_resource_layer_unittest.cc b/cc/layers/ui_resource_layer_unittest.cc
index 09d57a96520de55b498ce908fe2aa487af38e858..a4b2dd82c6806bacc40cafc994cff834a09325b1 100644
--- a/cc/layers/ui_resource_layer_unittest.cc
+++ b/cc/layers/ui_resource_layer_unittest.cc
@@ -28,6 +28,22 @@ using ::testing::AnyNumber;
namespace cc {
namespace {
+class TestUIResourceLayer : public UIResourceLayer {
+ public:
+ static scoped_refptr<TestUIResourceLayer> Create() {
+ return make_scoped_refptr(new TestUIResourceLayer());
+ }
+
+ UIResourceId GetUIResourceId() {
+ if (ui_resource_holder_)
+ return ui_resource_holder_->id();
+ return 0;
+ }
+
+ protected:
+ ~TestUIResourceLayer() override {}
+};
+
class UIResourceLayerTest : public testing::Test {
public:
UIResourceLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
@@ -102,6 +118,15 @@ TEST_F(UIResourceLayerTest, SetUIResourceId) {
test_layer->Update(&queue, &occlusion_tracker);
EXPECT_TRUE(test_layer->DrawsContent());
+
+ // ID is preserved even when you set ID first and attach it to the tree.
+ scoped_refptr<TestUIResourceLayer> new_test_layer =
+ TestUIResourceLayer::Create();
+ scoped_ptr<ScopedUIResource> new_resource = ScopedUIResource::Create(
+ layer_tree_host_.get(), UIResourceBitmap(gfx::Size(5, 5), is_opaque));
+ new_test_layer->SetUIResourceId(new_resource->id());
+ test_layer->AddChild(new_test_layer);
+ EXPECT_EQ(new_resource->id(), new_test_layer->GetUIResourceId());
danakj 2014/11/20 21:32:48 can you verify DrawsContent() as well like in the
Changwan Ryu 2014/11/20 21:58:24 Done.
}
} // namespace
« no previous file with comments | « cc/layers/ui_resource_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698