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

Side by Side Diff: ui/views/view_unittest.cc

Issue 10412044: layers: Consolidate the ownership of layers in views::View and aura::Window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 ASSERT_EQ(2u, parent_layer->children().size()); 3153 ASSERT_EQ(2u, parent_layer->children().size());
3154 EXPECT_EQ(c1->layer(), parent_layer->children()[0]); 3154 EXPECT_EQ(c1->layer(), parent_layer->children()[0]);
3155 EXPECT_EQ(c2->layer(), parent_layer->children()[1]); 3155 EXPECT_EQ(c2->layer(), parent_layer->children()[1]);
3156 3156
3157 // Move c1 to the front. The layers should have moved too. 3157 // Move c1 to the front. The layers should have moved too.
3158 content->ReorderChildView(c1, -1); 3158 content->ReorderChildView(c1, -1);
3159 EXPECT_EQ(c1->layer(), parent_layer->children()[1]); 3159 EXPECT_EQ(c1->layer(), parent_layer->children()[1]);
3160 EXPECT_EQ(c2->layer(), parent_layer->children()[0]); 3160 EXPECT_EQ(c2->layer(), parent_layer->children()[0]);
3161 } 3161 }
3162 3162
3163 // Verifies that the layer of a view can be acquired properly.
3164 TEST_F(ViewLayerTest, AcquireLayer) {
3165 View* content = new View;
3166 widget()->SetContentsView(content);
3167 View* c1 = new View;
3168 c1->SetPaintToLayer(true);
3169 EXPECT_TRUE(c1->layer());
3170
3171 scoped_ptr<ui::Layer> layer(c1->AcquireLayer());
3172 EXPECT_EQ(layer.get(), c1->layer());
3173
3174 layer.reset(c1->RecreateLayer());
3175 EXPECT_NE(c1->layer(), layer.get());
3176 }
3177
3163 #endif // USE_AURA 3178 #endif // USE_AURA
3164 3179
3165 } // namespace views 3180 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698