OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 701 |
702 // Showing an alert will raise the tab over the popup. | 702 // Showing an alert will raise the tab over the popup. |
703 #if !defined(OS_MACOSX) | 703 #if !defined(OS_MACOSX) |
704 // Mac doesn't activate the browser during modal dialogs, see | 704 // Mac doesn't activate the browser during modal dialogs, see |
705 // https://crbug.com/687732 for details. | 705 // https://crbug.com/687732 for details. |
706 ui_test_utils::BrowserActivationWaiter alert_waiter(browser()); | 706 ui_test_utils::BrowserActivationWaiter alert_waiter(browser()); |
707 #endif | 707 #endif |
708 tab->GetMainFrame()->ExecuteJavaScriptForTests( | 708 tab->GetMainFrame()->ExecuteJavaScriptForTests( |
709 base::UTF8ToUTF16("var o = document.createElement('object'); o.data = " | 709 base::UTF8ToUTF16("var o = document.createElement('object'); o.data = " |
710 "'/alert_dialog.pdf'; document.body.appendChild(o);")); | 710 "'/alert_dialog.pdf'; document.body.appendChild(o);")); |
711 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); | 711 app_modal::JavaScriptAppModalDialog* dialog = |
| 712 ui_test_utils::WaitForAppModalDialog(); |
712 #if !defined(OS_MACOSX) | 713 #if !defined(OS_MACOSX) |
713 if (chrome::FindLastActive() != browser()) | 714 if (chrome::FindLastActive() != browser()) |
714 alert_waiter.WaitForActivation(); | 715 alert_waiter.WaitForActivation(); |
715 #endif | 716 #endif |
716 | 717 |
717 // Verify that after the dialog was closed, the popup is in front again. | 718 // Verify that after the dialog was closed, the popup is in front again. |
718 ASSERT_TRUE(dialog->IsJavaScriptModalDialog()); | |
719 app_modal::JavaScriptAppModalDialog* js_dialog = | |
720 static_cast<app_modal::JavaScriptAppModalDialog*>(dialog); | |
721 | |
722 ui_test_utils::BrowserActivationWaiter waiter(popup_browser); | 719 ui_test_utils::BrowserActivationWaiter waiter(popup_browser); |
723 js_dialog->native_dialog()->AcceptAppModalDialog(); | 720 dialog->native_dialog()->AcceptAppModalDialog(); |
724 waiter.WaitForActivation(); | 721 waiter.WaitForActivation(); |
725 ASSERT_EQ(popup_browser, chrome::FindLastActive()); | 722 ASSERT_EQ(popup_browser, chrome::FindLastActive()); |
726 } | 723 } |
727 | 724 |
728 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ModalPopUnderViaHTTPAuth) { | 725 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ModalPopUnderViaHTTPAuth) { |
729 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 726 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
730 GURL url( | 727 GURL url( |
731 embedded_test_server()->GetURL("/popup_blocker/popup-window-open.html")); | 728 embedded_test_server()->GetURL("/popup_blocker/popup-window-open.html")); |
732 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 729 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
733 ->SetContentSettingDefaultScope(url, GURL(), CONTENT_SETTINGS_TYPE_POPUPS, | 730 ->SetContentSettingDefaultScope(url, GURL(), CONTENT_SETTINGS_TYPE_POPUPS, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 816 |
820 wait_for_new_tab.Wait(); | 817 wait_for_new_tab.Wait(); |
821 | 818 |
822 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); | 819 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); |
823 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 820 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
824 // Check that we create the background tab. | 821 // Check that we create the background tab. |
825 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 822 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
826 } | 823 } |
827 | 824 |
828 } // namespace | 825 } // namespace |
OLD | NEW |