| 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 "chrome/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/common/net/url_fixer_upper.h" | 9 #include "chrome/common/net/url_fixer_upper.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Try to reload it twice, checking for repost. | 36 // Try to reload it twice, checking for repost. |
| 37 content::WebContents* web_contents = | 37 content::WebContents* web_contents = |
| 38 browser()->tab_strip_model()->GetActiveWebContents(); | 38 browser()->tab_strip_model()->GetActiveWebContents(); |
| 39 web_contents->GetController().Reload(true); | 39 web_contents->GetController().Reload(true); |
| 40 web_contents->GetController().Reload(true); | 40 web_contents->GetController().Reload(true); |
| 41 | 41 |
| 42 // There should only be one dialog open. | 42 // There should only be one dialog open. |
| 43 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 43 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 44 WebContentsModalDialogManager::FromWebContents(web_contents); | 44 WebContentsModalDialogManager::FromWebContents(web_contents); |
| 45 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); | 45 EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive()); |
| 46 | 46 |
| 47 // Navigate away from the page (this is when the test usually crashes). | 47 // Navigate away from the page (this is when the test usually crashes). |
| 48 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("bar")); | 48 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("bar")); |
| 49 | 49 |
| 50 // The dialog should've been closed. | 50 // The dialog should've been closed. |
| 51 EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); | 51 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // If becomes flaky, disable on Windows and use http://crbug.com/47228 | 54 // If becomes flaky, disable on Windows and use http://crbug.com/47228 |
| 55 IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { | 55 IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { |
| 56 ASSERT_TRUE(test_server()->Start()); | 56 ASSERT_TRUE(test_server()->Start()); |
| 57 | 57 |
| 58 // Load a form. | 58 // Load a form. |
| 59 ui_test_utils::NavigateToURL( | 59 ui_test_utils::NavigateToURL( |
| 60 browser(), test_server()->GetURL("files/form.html")); | 60 browser(), test_server()->GetURL("files/form.html")); |
| 61 // Submit it. | 61 // Submit it. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 // Navigate away from the page. We can't use ui_test_utils:NavigateToURL | 85 // Navigate away from the page. We can't use ui_test_utils:NavigateToURL |
| 86 // because that waits for the current page to stop loading first, which won't | 86 // because that waits for the current page to stop loading first, which won't |
| 87 // happen while the auth dialog is up. | 87 // happen while the auth dialog is up. |
| 88 content::TestNavigationObserver navigation_observer(web_contents); | 88 content::TestNavigationObserver navigation_observer(web_contents); |
| 89 browser()->OpenURL(content::OpenURLParams( | 89 browser()->OpenURL(content::OpenURLParams( |
| 90 test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB, | 90 test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB, |
| 91 content::PAGE_TRANSITION_TYPED, false)); | 91 content::PAGE_TRANSITION_TYPED, false)); |
| 92 navigation_observer.Wait(); | 92 navigation_observer.Wait(); |
| 93 } | 93 } |
| OLD | NEW |