| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_wrapper.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/models/accelerator.h" | 12 #include "ui/base/models/accelerator.h" |
| 13 #include "ui/views/focus/focus_manager.h" |
| 14 #include "ui/views/layout/fill_layout.h" |
| 13 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 14 #include "views/controls/textfield/textfield.h" | 16 #include "views/controls/textfield/textfield.h" |
| 15 #include "views/focus/focus_manager.h" | |
| 16 #include "views/layout/fill_layout.h" | |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class TestConstrainedDialogContentsView | 20 class TestConstrainedDialogContentsView |
| 21 : public views::View, | 21 : public views::View, |
| 22 public base::SupportsWeakPtr<TestConstrainedDialogContentsView> { | 22 public base::SupportsWeakPtr<TestConstrainedDialogContentsView> { |
| 23 public: | 23 public: |
| 24 TestConstrainedDialogContentsView() | 24 TestConstrainedDialogContentsView() |
| 25 : text_field_(new views::Textfield) { | 25 : text_field_(new views::Textfield) { |
| 26 SetLayoutManager(new views::FillLayout); | 26 SetLayoutManager(new views::FillLayout); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 EXPECT_EQ(test_dialog2->GetInitiallyFocusedView(), | 164 EXPECT_EQ(test_dialog2->GetInitiallyFocusedView(), |
| 165 focus_manager->GetFocusedView()); | 165 focus_manager->GetFocusedView()); |
| 166 | 166 |
| 167 // Send another VKEY_RETURN, closing test_dialog2 | 167 // Send another VKEY_RETURN, closing test_dialog2 |
| 168 EXPECT_TRUE(focus_manager->ProcessAccelerator( | 168 EXPECT_TRUE(focus_manager->ProcessAccelerator( |
| 169 ui::Accelerator(ui::VKEY_RETURN, false, false, false))); | 169 ui::Accelerator(ui::VKEY_RETURN, false, false, false))); |
| 170 ui_test_utils::RunAllPendingInMessageLoop(); | 170 ui_test_utils::RunAllPendingInMessageLoop(); |
| 171 EXPECT_TRUE(test_dialog2->done()); | 171 EXPECT_TRUE(test_dialog2->done()); |
| 172 EXPECT_EQ(0u, constrained_window_helper->constrained_window_count()); | 172 EXPECT_EQ(0u, constrained_window_helper->constrained_window_count()); |
| 173 } | 173 } |
| OLD | NEW |