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

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

Issue 13584010: views: Migrate the cases of "new .*NativeTextButton(" to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: back out the changes to one_click_signin_bubble_view.* 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
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"
11 #include "ui/views/controls/button/text_button.h" 11 #include "ui/views/controls/button/label_button.h"
12 #include "ui/views/focus/accelerator_handler.h" 12 #include "ui/views/focus/accelerator_handler.h"
13 #include "ui/views/focus/focus_manager_test.h" 13 #include "ui/views/focus/focus_manager_test.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 15
16 namespace views { 16 namespace views {
17 17
18 namespace { 18 namespace {
19 19
20 class MessageTrackingView : public View { 20 class MessageTrackingView : public View {
21 public: 21 public:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 }; 63 };
64 64
65 } // namespace 65 } // namespace
66 66
67 // Test that when activating/deactivating the top window, the focus is stored/ 67 // Test that when activating/deactivating the top window, the focus is stored/
68 // restored properly. 68 // restored properly.
69 TEST_F(FocusManagerTest, FocusStoreRestore) { 69 TEST_F(FocusManagerTest, FocusStoreRestore) {
70 // Simulate an activate, otherwise the deactivate isn't going to do anything. 70 // Simulate an activate, otherwise the deactivate isn't going to do anything.
71 SimulateActivateWindow(); 71 SimulateActivateWindow();
72 72
73 NativeTextButton* button = new NativeTextButton(NULL, 73 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Press me"));
74 ASCIIToUTF16("Press me")); 74 button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
75 View* view = new View(); 75 View* view = new View();
76 view->set_focusable(true); 76 view->set_focusable(true);
77 77
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);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 PostKeyUp(ui::VKEY_0); 272 PostKeyUp(ui::VKEY_0);
273 run_loop.reset(new base::RunLoop(&accelerator_handler)); 273 run_loop.reset(new base::RunLoop(&accelerator_handler));
274 run_loop->RunUntilIdle(); 274 run_loop->RunUntilIdle();
275 EXPECT_TRUE(mtv->keys_pressed().empty()); 275 EXPECT_TRUE(mtv->keys_pressed().empty());
276 EXPECT_TRUE(mtv->keys_released().empty()); 276 EXPECT_TRUE(mtv->keys_released().empty());
277 EXPECT_TRUE(mtv->accelerator_pressed()); 277 EXPECT_TRUE(mtv->accelerator_pressed());
278 mtv->Reset(); 278 mtv->Reset();
279 } 279 }
280 280
281 } // namespace views 281 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/speech_recognition_bubble_views.cc ('k') | ui/views/focus/focus_traversal_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698