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

Side by Side 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: added unit test, going back to patch #5 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 unified diff | Download patch
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/ui_resource_layer.h" 5 #include "cc/layers/ui_resource_layer.h"
6 6
7 #include "cc/resources/prioritized_resource_manager.h" 7 #include "cc/resources/prioritized_resource_manager.h"
8 #include "cc/resources/resource_provider.h" 8 #include "cc/resources/resource_provider.h"
9 #include "cc/resources/resource_update_queue.h" 9 #include "cc/resources/resource_update_queue.h"
10 #include "cc/resources/scoped_ui_resource.h" 10 #include "cc/resources/scoped_ui_resource.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 EXPECT_FALSE(test_layer->DrawsContent()); 96 EXPECT_FALSE(test_layer->DrawsContent());
97 97
98 bool is_opaque = false; 98 bool is_opaque = false;
99 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( 99 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create(
100 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); 100 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque));
101 test_layer->SetUIResourceId(resource->id()); 101 test_layer->SetUIResourceId(resource->id());
102 test_layer->Update(&queue, &occlusion_tracker); 102 test_layer->Update(&queue, &occlusion_tracker);
103 103
104 EXPECT_TRUE(test_layer->DrawsContent()); 104 EXPECT_TRUE(test_layer->DrawsContent());
105
106 // ID is preserved even when you set ID first and attach it to the tree.
107 scoped_refptr<UIResourceLayer> new_test_layer = UIResourceLayer::Create();
108 scoped_ptr<ScopedUIResource> new_resource = ScopedUIResource::Create(
109 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(5, 5), is_opaque));
110 new_test_layer->SetUIResourceId(new_resource->id());
111 test_layer->AddChild(new_test_layer);
112 EXPECT_EQ(new_resource->id(), new_test_layer->GetUIResourceId());
105 } 113 }
106 114
107 } // namespace 115 } // namespace
108 } // namespace cc 116 } // namespace cc
OLDNEW
« cc/layers/ui_resource_layer.cc ('K') | « cc/layers/ui_resource_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698