| OLD | NEW |
| 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 "components/constrained_window/constrained_window_views.h" | 5 #include "components/constrained_window/constrained_window_views.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(TestDialog); | 52 DISALLOW_COPY_AND_ASSIGN(TestDialog); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // A helper function to create and show a web contents modal dialog. | 55 // A helper function to create and show a web contents modal dialog. |
| 56 scoped_ptr<TestDialog> ShowModalDialog(content::WebContents* web_contents) { | 56 scoped_ptr<TestDialog> ShowModalDialog(content::WebContents* web_contents) { |
| 57 scoped_ptr<TestDialog> dialog(new TestDialog()); | 57 scoped_ptr<TestDialog> dialog(new TestDialog()); |
| 58 constrained_window::ShowWebModalDialogViews(dialog.get(), web_contents); | 58 constrained_window::ShowWebModalDialogViews(dialog.get(), web_contents); |
| 59 return dialog.Pass(); | 59 return dialog; |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 typedef InProcessBrowserTest ConstrainedWindowViewTest; | 64 typedef InProcessBrowserTest ConstrainedWindowViewTest; |
| 65 | 65 |
| 66 // Tests the intial focus of tab-modal dialogs, the restoration of focus to the | 66 // Tests the intial focus of tab-modal dialogs, the restoration of focus to the |
| 67 // browser when they close, and that queued dialogs don't register themselves as | 67 // browser when they close, and that queued dialogs don't register themselves as |
| 68 // accelerator targets until they are displayed. | 68 // accelerator targets until they are displayed. |
| 69 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { | 69 IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 #endif | 209 #endif |
| 210 | 210 |
| 211 scoped_ptr<TestDialog> dialog = ShowModalDialog( | 211 scoped_ptr<TestDialog> dialog = ShowModalDialog( |
| 212 browser()->tab_strip_model()->GetActiveWebContents()); | 212 browser()->tab_strip_model()->GetActiveWebContents()); |
| 213 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); | 213 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
| 214 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, | 214 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, |
| 215 false, false, false, false)); | 215 false, false, false, false)); |
| 216 content::RunAllPendingInMessageLoop(); | 216 content::RunAllPendingInMessageLoop(); |
| 217 EXPECT_EQ(NULL, dialog->GetWidget()); | 217 EXPECT_EQ(NULL, dialog->GetWidget()); |
| 218 } | 218 } |
| OLD | NEW |