| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 | 26 |
| 27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 28 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 class TestDialog : public views::DialogDelegateView { | 33 class TestDialog : public views::DialogDelegateView { |
| 34 public: | 34 public: |
| 35 TestDialog() { SetFocusable(true); } | 35 TestDialog() { SetFocusBehavior(FocusBehavior::ALWAYS); } |
| 36 ~TestDialog() override {} | 36 ~TestDialog() override {} |
| 37 | 37 |
| 38 views::View* GetInitiallyFocusedView() override { return this; } | 38 views::View* GetInitiallyFocusedView() override { return this; } |
| 39 // Don't delete the delegate yet. Keep it around for inspection later. | 39 // Don't delete the delegate yet. Keep it around for inspection later. |
| 40 void DeleteDelegate() override {} | 40 void DeleteDelegate() override {} |
| 41 | 41 |
| 42 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_CHILD; } | 42 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_CHILD; } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(TestDialog); | 45 DISALLOW_COPY_AND_ASSIGN(TestDialog); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 std::unique_ptr<TestDialog> dialog = | 205 std::unique_ptr<TestDialog> dialog = |
| 206 ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); | 206 ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); |
| 207 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); | 207 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
| 208 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, | 208 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, |
| 209 false, false, false, false)); | 209 false, false, false, false)); |
| 210 content::RunAllPendingInMessageLoop(); | 210 content::RunAllPendingInMessageLoop(); |
| 211 EXPECT_EQ(NULL, dialog->GetWidget()); | 211 EXPECT_EQ(NULL, dialog->GetWidget()); |
| 212 } | 212 } |
| OLD | NEW |