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

Side by Side Diff: views/focus/focus_manager_unittest.cc

Issue 141013: Relanding focus manager refactoring (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « views/focus/focus_manager.cc ('k') | views/view.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Disabled right now as this won't work on BuildBots right now as this test 5 // Disabled right now as this won't work on BuildBots right now as this test
6 // require the box it runs on to be unlocked (and no screen-savers). 6 // require the box it runs on to be unlocked (and no screen-savers).
7 // The test actually simulates mouse and key events, so if the screen is locked, 7 // The test actually simulates mouse and key events, so if the screen is locked,
8 // the events don't go to the Chrome window. 8 // the events don't go to the Chrome window.
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 virtual HWND CreateNativeControl(HWND parent_container) { 112 virtual HWND CreateNativeControl(HWND parent_container) {
113 // Create the tab control. 113 // Create the tab control.
114 HWND tab_control = ::CreateWindowEx(GetAdditionalExStyle(), 114 HWND tab_control = ::CreateWindowEx(GetAdditionalExStyle(),
115 WC_TABCONTROL, 115 WC_TABCONTROL,
116 L"", 116 L"",
117 WS_CHILD, 117 WS_CHILD,
118 0, 0, width(), height(), 118 0, 0, width(), height(),
119 parent_container, NULL, NULL, NULL); 119 parent_container, NULL, NULL, NULL);
120 // Create the view container which is a child of the TabControl. 120 // Create the view container which is a child of the TabControl.
121 widget_ = new WidgetWin(); 121 widget_ = new WidgetWin();
122 widget_->Init(tab_control, gfx::Rect(), false); 122 widget_->Init(tab_control, gfx::Rect());
123 widget_->SetContentsView(child_); 123 widget_->SetContentsView(child_);
124 widget_->SetFocusTraversableParentView(this); 124 widget_->SetFocusTraversableParentView(this);
125 ResizeContents(tab_control); 125 ResizeContents(tab_control);
126 return tab_control; 126 return tab_control;
127 } 127 }
128 128
129 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param) { 129 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param) {
130 return 0; 130 return 0;
131 } 131 }
132 132
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 virtual void TearDown() { 203 virtual void TearDown() {
204 if (focus_change_listener_) 204 if (focus_change_listener_)
205 GetFocusManager()->RemoveFocusChangeListener(focus_change_listener_); 205 GetFocusManager()->RemoveFocusChangeListener(focus_change_listener_);
206 window_->CloseNow(); 206 window_->CloseNow();
207 207
208 // Flush the message loop to make Purify happy. 208 // Flush the message loop to make Purify happy.
209 message_loop()->RunAllPending(); 209 message_loop()->RunAllPending();
210 } 210 }
211 211
212 FocusManager* GetFocusManager() { 212 FocusManager* GetFocusManager() {
213 return FocusManager::GetFocusManager(window_->GetNativeWindow()); 213 return FocusManager::GetFocusManagerForNativeView(
214 window_->GetNativeWindow());
214 } 215 }
215 216
216 // WindowDelegate Implementation. 217 // WindowDelegate Implementation.
217 virtual View* GetContentsView() { 218 virtual View* GetContentsView() {
218 if (!content_view_) 219 if (!content_view_)
219 content_view_ = new View(); 220 content_view_ = new View();
220 return content_view_; 221 return content_view_;
221 } 222 }
222 223
223 virtual void InitContentView() { 224 virtual void InitContentView() {
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 EXPECT_EQ(target.accelerator_count(), 1); 1109 EXPECT_EQ(target.accelerator_count(), 1);
1109 EXPECT_EQ(NULL, 1110 EXPECT_EQ(NULL,
1110 focus_manager->GetCurrentTargetForAccelerator(return_accelerator)); 1111 focus_manager->GetCurrentTargetForAccelerator(return_accelerator));
1111 1112
1112 // Hitting the return key again; nothing should happen. 1113 // Hitting the return key again; nothing should happen.
1113 EXPECT_FALSE(focus_manager->ProcessAccelerator(return_accelerator)); 1114 EXPECT_FALSE(focus_manager->ProcessAccelerator(return_accelerator));
1114 EXPECT_EQ(target.accelerator_count(), 1); 1115 EXPECT_EQ(target.accelerator_count(), 1);
1115 } 1116 }
1116 1117
1117 } // namespace views 1118 } // namespace views
OLDNEW
« no previous file with comments | « views/focus/focus_manager.cc ('k') | views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698