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

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

Issue 13639003: Make LabelButton STYLE_NATIVE_TEXTBUTTON focusable; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. Created 7 years, 8 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/controls/button/label_button.cc ('k') | ui/views/focus/focus_traversal_unittest.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) 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 "ui/views/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/events/event.h" 10 #include "ui/base/events/event.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 GetContentsView()->AddChildView(button); 78 GetContentsView()->AddChildView(button);
79 button->SetBounds(10, 10, 200, 30); 79 button->SetBounds(10, 10, 200, 30);
80 GetContentsView()->AddChildView(view); 80 GetContentsView()->AddChildView(view);
81 RunPendingMessages(); 81 RunPendingMessages();
82 82
83 TestFocusChangeListener listener; 83 TestFocusChangeListener listener;
84 AddFocusChangeListener(&listener); 84 AddFocusChangeListener(&listener);
85 85
86 view->RequestFocus(); 86 view->RequestFocus();
87 RunPendingMessages(); 87 RunPendingMessages();
88 // MessageLoopForUI::current()->RunWithDispatcher(new AcceleratorHandler());
89 88
90 // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/det ails/520043/error-converting-from-null-to-a-pointer-type-in-std-pair 89 // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/det ails/520043/error-converting-from-null-to-a-pointer-type-in-std-pair
91 views::View* null_view = NULL; 90 views::View* null_view = NULL;
92 91
93 // Deacivate the window, it should store its focus. 92 // Deacivate the window, it should store its focus.
94 SimulateDeactivateWindow(); 93 SimulateDeactivateWindow();
95 EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView()); 94 EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView());
96 ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size())); 95 ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size()));
97 EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view)); 96 EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view));
98 EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(view, null_view)); 97 EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(view, null_view));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 PostKeyUp(ui::VKEY_0); 272 PostKeyUp(ui::VKEY_0);
274 run_loop.reset(new base::RunLoop(&accelerator_handler)); 273 run_loop.reset(new base::RunLoop(&accelerator_handler));
275 run_loop->RunUntilIdle(); 274 run_loop->RunUntilIdle();
276 EXPECT_TRUE(mtv->keys_pressed().empty()); 275 EXPECT_TRUE(mtv->keys_pressed().empty());
277 EXPECT_TRUE(mtv->keys_released().empty()); 276 EXPECT_TRUE(mtv->keys_released().empty());
278 EXPECT_TRUE(mtv->accelerator_pressed()); 277 EXPECT_TRUE(mtv->accelerator_pressed());
279 mtv->Reset(); 278 mtv->Reset();
280 } 279 }
281 280
282 } // namespace views 281 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/focus/focus_traversal_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698