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

Side by Side Diff: ui/views/focus/focus_traversal_unittest.cc

Issue 2484203002: Revert of Fix leak in FocusManager tests (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // BorderView is a view containing a native window with its own view hierarchy. 130 // BorderView is a view containing a native window with its own view hierarchy.
131 // It is interesting to test focus traversal from a view hierarchy to an inner 131 // It is interesting to test focus traversal from a view hierarchy to an inner
132 // view hierarchy. 132 // view hierarchy.
133 class BorderView : public NativeViewHost { 133 class BorderView : public NativeViewHost {
134 public: 134 public:
135 explicit BorderView(View* child) : child_(child), widget_(NULL) { 135 explicit BorderView(View* child) : child_(child), widget_(NULL) {
136 DCHECK(child); 136 DCHECK(child);
137 SetFocusBehavior(FocusBehavior::NEVER); 137 SetFocusBehavior(FocusBehavior::NEVER);
138 } 138 }
139 139
140 ~BorderView() override { 140 ~BorderView() override {}
141 if (widget_)
142 widget_->CloseNow();
143 }
144 141
145 virtual internal::RootView* GetContentsRootView() { 142 virtual internal::RootView* GetContentsRootView() {
146 return static_cast<internal::RootView*>(widget_->GetRootView()); 143 return static_cast<internal::RootView*>(widget_->GetRootView());
147 } 144 }
148 145
149 FocusTraversable* GetFocusTraversable() override { 146 FocusTraversable* GetFocusTraversable() override {
150 return static_cast<internal::RootView*>(widget_->GetRootView()); 147 return static_cast<internal::RootView*>(widget_->GetRootView());
151 } 148 }
152 149
153 void ViewHierarchyChanged( 150 void ViewHierarchyChanged(
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 GetFocusManager()->AdvanceFocus(false); 879 GetFocusManager()->AdvanceFocus(false);
883 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); 880 EXPECT_FALSE(GetFocusManager()->GetFocusedView());
884 881
885 // Advance backwards from the root node. 882 // Advance backwards from the root node.
886 GetFocusManager()->ClearFocus(); 883 GetFocusManager()->ClearFocus();
887 GetFocusManager()->AdvanceFocus(true); 884 GetFocusManager()->AdvanceFocus(true);
888 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); 885 EXPECT_FALSE(GetFocusManager()->GetFocusedView());
889 } 886 }
890 887
891 } // namespace views 888 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698