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

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

Issue 7104042: ui/views: Fix the signature of View::OnViewAdded/Removed overridden methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky,peter review Created 9 years, 6 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 | « no previous file | ui/views/widget/root_view.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/compiler_specific.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
9 #include "ui/views/view.h" 10 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h" 11 #include "ui/views/widget/widget.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 class ViewTest : public testing::Test { 15 class ViewTest : public testing::Test {
15 public: 16 public:
16 ViewTest() {} 17 ViewTest() {}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 subject_view_(NULL) {} 63 subject_view_(NULL) {}
63 virtual ~ObserverView() {} 64 virtual ~ObserverView() {}
64 65
65 void ResetTestState() { 66 void ResetTestState() {
66 view_added_ = false; 67 view_added_ = false;
67 view_removed_ = false; 68 view_removed_ = false;
68 subject_view_ = NULL; 69 subject_view_ = NULL;
69 } 70 }
70 71
71 // Overridden from View: 72 // Overridden from View:
72 virtual void OnViewAdded(View* parent, View* child) { 73 virtual void OnViewAdded(const View& parent, const View& child) OVERRIDE {
73 subject_view_ = child;
74 view_added_ = true; 74 view_added_ = true;
75 view_removed_ = false; 75 view_removed_ = false;
76 subject_view_ = &child;
76 } 77 }
77 virtual void OnViewRemoved(View* parent, View* child) { 78 virtual void OnViewRemoved(const View& parent, const View& child) OVERRIDE {
78 subject_view_ = child; 79 view_added_ = false;
79 view_removed_ = true; 80 view_removed_ = true;
80 view_added_ = false; 81 subject_view_ = &child;
81 } 82 }
82 83
83 bool view_added() const { return view_added_; } 84 bool view_added() const { return view_added_; }
84 bool view_removed() const { return view_removed_; } 85 bool view_removed() const { return view_removed_; }
85 View* subject_view() const { return subject_view_; } 86 View* subject_view() const { return subject_view_; }
86 87
87 private: 88 private:
88 bool view_added_; 89 bool view_added_;
89 bool view_removed_; 90 bool view_removed_;
90 View* subject_view_; 91 View* subject_view_;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 TEST_F(ViewTest, EventHandlers) { 197 TEST_F(ViewTest, EventHandlers) {
197 198
198 } 199 }
199 200
200 TEST_F(ViewTest, Painting) { 201 TEST_F(ViewTest, Painting) {
201 202
202 } 203 }
203 204
204 } // namespace ui 205 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/root_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698