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

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

Issue 11416251: Desktop aura: Continue threading context through views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix erroneously removed line from NWWin tests. Created 8 years 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/focus/focus_manager_test.cc ('k') | ui/views/test/views_test_base.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) 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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/base/accelerators/accelerator.h" 9 #include "ui/base/accelerators/accelerator.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 10 #include "ui/base/keycodes/keyboard_codes.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 GetFocusManager()->ClearFocus(); 130 GetFocusManager()->ClearFocus();
131 ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size())); 131 ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size()));
132 EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view2, null_view)); 132 EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view2, null_view));
133 } 133 }
134 134
135 TEST_F(FocusManagerTest, WidgetFocusChangeListener) { 135 TEST_F(FocusManagerTest, WidgetFocusChangeListener) {
136 TestWidgetFocusChangeListener widget_listener; 136 TestWidgetFocusChangeListener widget_listener;
137 AddWidgetFocusChangeListener(&widget_listener); 137 AddWidgetFocusChangeListener(&widget_listener);
138 138
139 Widget::InitParams params; 139 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
140 params.type = views::Widget::InitParams::TYPE_WINDOW;
141 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
142 params.bounds = gfx::Rect(10, 10, 100, 100); 140 params.bounds = gfx::Rect(10, 10, 100, 100);
143 params.parent_widget = GetWidget(); 141 params.parent_widget = GetWidget();
144 142
145 scoped_ptr<Widget> widget1(new Widget); 143 scoped_ptr<Widget> widget1(new Widget);
146 widget1->Init(params); 144 widget1->Init(params);
147 widget1->Show(); 145 widget1->Show();
148 146
149 scoped_ptr<Widget> widget2(new Widget); 147 scoped_ptr<Widget> widget2(new Widget);
150 widget2->Init(params); 148 widget2->Init(params);
151 widget2->Show(); 149 widget2->Show();
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 views::View* v3 = new View; 695 views::View* v3 = new View;
698 v3->set_focusable(true); 696 v3->set_focusable(true);
699 GetContentsView()->AddChildView(v3); 697 GetContentsView()->AddChildView(v3);
700 698
701 v3->RequestFocus(); 699 v3->RequestFocus();
702 GetWidget()->GetFocusManager()->AdvanceFocus(true); 700 GetWidget()->GetFocusManager()->AdvanceFocus(true);
703 EXPECT_TRUE(v1->HasFocus()); 701 EXPECT_TRUE(v1->HasFocus());
704 } 702 }
705 703
706 } // namespace views 704 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/focus/focus_manager_test.cc ('k') | ui/views/test/views_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698