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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views_browsertest.cc

Issue 10540100: TabContentsWrapper -> TabContents, part 48. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
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 "base/memory/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/constrained_window_tab_helper.h" 7 #include "chrome/browser/ui/constrained_window_tab_helper.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents.h"
9 #include "chrome/browser/ui/views/constrained_window_views.h" 9 #include "chrome/browser/ui/views/constrained_window_views.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "ui/base/accelerators/accelerator.h" 12 #include "ui/base/accelerators/accelerator.h"
13 #include "ui/views/controls/textfield/textfield.h" 13 #include "ui/views/controls/textfield/textfield.h"
14 #include "ui/views/focus/focus_manager.h" 14 #include "ui/views/focus/focus_manager.h"
15 #include "ui/views/layout/fill_layout.h" 15 #include "ui/views/layout/fill_layout.h"
16 #include "ui/views/window/dialog_delegate.h" 16 #include "ui/views/window/dialog_delegate.h"
17 17
18 namespace { 18 namespace {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 }; 98 };
99 99
100 // Tests the following: 100 // Tests the following:
101 // 101 //
102 // *) Initially focused view in a constrained dialog receives focus reliably. 102 // *) Initially focused view in a constrained dialog receives focus reliably.
103 // 103 //
104 // *) Constrained windows that are queued don't register themselves as 104 // *) Constrained windows that are queued don't register themselves as
105 // accelerator targets until they are displayed. 105 // accelerator targets until they are displayed.
106 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { 106 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) {
107 TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper(); 107 TabContents* tab_contents = browser()->GetActiveTabContents();
108 ASSERT_TRUE(tab_contents != NULL); 108 ASSERT_TRUE(tab_contents != NULL);
109 ConstrainedWindowTabHelper* constrained_window_helper = 109 ConstrainedWindowTabHelper* constrained_window_helper =
110 tab_contents->constrained_window_tab_helper(); 110 tab_contents->constrained_window_tab_helper();
111 ASSERT_TRUE(constrained_window_helper != NULL); 111 ASSERT_TRUE(constrained_window_helper != NULL);
112 112
113 // Create a constrained dialog. It will attach itself to tab_contents. 113 // Create a constrained dialog. It will attach itself to tab_contents.
114 scoped_ptr<TestConstrainedDialog> test_dialog1(new TestConstrainedDialog); 114 scoped_ptr<TestConstrainedDialog> test_dialog1(new TestConstrainedDialog);
115 ConstrainedWindowViews* window1 = 115 ConstrainedWindowViews* window1 =
116 new ConstrainedWindowViews(tab_contents, test_dialog1.get()); 116 new ConstrainedWindowViews(tab_contents, test_dialog1.get());
117 117
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EXPECT_EQ(test_dialog2->GetInitiallyFocusedView(), 165 EXPECT_EQ(test_dialog2->GetInitiallyFocusedView(),
166 focus_manager->GetFocusedView()); 166 focus_manager->GetFocusedView());
167 167
168 // Send another VKEY_RETURN, closing test_dialog2 168 // Send another VKEY_RETURN, closing test_dialog2
169 EXPECT_TRUE(focus_manager->ProcessAccelerator( 169 EXPECT_TRUE(focus_manager->ProcessAccelerator(
170 ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE))); 170 ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)));
171 ui_test_utils::RunAllPendingInMessageLoop(); 171 ui_test_utils::RunAllPendingInMessageLoop();
172 EXPECT_TRUE(test_dialog2->done()); 172 EXPECT_TRUE(test_dialog2->done());
173 EXPECT_EQ(0u, constrained_window_helper->constrained_window_count()); 173 EXPECT_EQ(0u, constrained_window_helper->constrained_window_count());
174 } 174 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.cc ('k') | chrome/browser/ui/views/create_application_shortcut_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698