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

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

Issue 9333005: Fix some memory leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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/base/x/x11_util.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 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 content_view->AddChildView(v1); 2821 content_view->AddChildView(v1);
2822 2822
2823 View* v2 = new View; 2823 View* v2 = new View;
2824 v1->AddChildView(v2); 2824 v1->AddChildView(v2);
2825 v2->SetPaintToLayer(true); 2825 v2->SetPaintToLayer(true);
2826 EXPECT_TRUE(LayerIsAncestor(widget()->GetCompositor()->root_layer(), 2826 EXPECT_TRUE(LayerIsAncestor(widget()->GetCompositor()->root_layer(),
2827 v2->layer())); 2827 v2->layer()));
2828 EXPECT_TRUE(v2->layer()->IsDrawn()); 2828 EXPECT_TRUE(v2->layer()->IsDrawn());
2829 2829
2830 content_view->RemoveChildView(v1); 2830 content_view->RemoveChildView(v1);
2831
2831 EXPECT_FALSE(LayerIsAncestor(widget()->GetCompositor()->root_layer(), 2832 EXPECT_FALSE(LayerIsAncestor(widget()->GetCompositor()->root_layer(),
2832 v2->layer())); 2833 v2->layer()));
2833 2834
2834 // Reparent |v2|. 2835 // Reparent |v2|.
2835 content_view->AddChildView(v2); 2836 content_view->AddChildView(v2);
2837 delete v1;
2838 v1 = NULL;
2836 EXPECT_TRUE(LayerIsAncestor(widget()->GetCompositor()->root_layer(), 2839 EXPECT_TRUE(LayerIsAncestor(widget()->GetCompositor()->root_layer(),
2837 v2->layer())); 2840 v2->layer()));
2838 EXPECT_TRUE(v2->layer()->IsDrawn()); 2841 EXPECT_TRUE(v2->layer()->IsDrawn());
2839 } 2842 }
2840 2843
2841 class PaintTrackingView : public View { 2844 class PaintTrackingView : public View {
2842 public: 2845 public:
2843 PaintTrackingView() : painted_(false) { 2846 PaintTrackingView() : painted_(false) {
2844 } 2847 }
2845 2848
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 2969
2967 // Move c1 to the front. The layers should have moved too. 2970 // Move c1 to the front. The layers should have moved too.
2968 content->ReorderChildView(c1, -1); 2971 content->ReorderChildView(c1, -1);
2969 EXPECT_EQ(c1->layer(), parent_layer->children()[1]); 2972 EXPECT_EQ(c1->layer(), parent_layer->children()[1]);
2970 EXPECT_EQ(c2->layer(), parent_layer->children()[0]); 2973 EXPECT_EQ(c2->layer(), parent_layer->children()[0]);
2971 } 2974 }
2972 2975
2973 #endif // USE_AURA 2976 #endif // USE_AURA
2974 2977
2975 } // namespace views 2978 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698