| 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/net/url_fixer_upper.h" | 6 #include "chrome/browser/net/url_fixer_upper.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 9 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 browser(), | 64 browser(), |
| 65 GURL("javascript:document.getElementById('form').submit()")); | 65 GURL("javascript:document.getElementById('form').submit()")); |
| 66 | 66 |
| 67 // Try to reload it, checking for repost. | 67 // Try to reload it, checking for repost. |
| 68 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 68 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 69 web_contents->GetController().Reload(true); | 69 web_contents->GetController().Reload(true); |
| 70 | 70 |
| 71 // Navigate to a page that requires authentication, bringing up another | 71 // Navigate to a page that requires authentication, bringing up another |
| 72 // tab-modal sheet. | 72 // tab-modal sheet. |
| 73 content::NavigationController& controller = web_contents->GetController(); | 73 content::NavigationController& controller = web_contents->GetController(); |
| 74 ui_test_utils::WindowedNotificationObserver observer( | 74 content::WindowedNotificationObserver observer( |
| 75 chrome::NOTIFICATION_AUTH_NEEDED, | 75 chrome::NOTIFICATION_AUTH_NEEDED, |
| 76 content::Source<content::NavigationController>(&controller)); | 76 content::Source<content::NavigationController>(&controller)); |
| 77 browser()->OpenURL(content::OpenURLParams( | 77 browser()->OpenURL(content::OpenURLParams( |
| 78 test_server()->GetURL("auth-basic"), content::Referrer(), CURRENT_TAB, | 78 test_server()->GetURL("auth-basic"), content::Referrer(), CURRENT_TAB, |
| 79 content::PAGE_TRANSITION_TYPED, false)); | 79 content::PAGE_TRANSITION_TYPED, false)); |
| 80 observer.Wait(); | 80 observer.Wait(); |
| 81 | 81 |
| 82 // Try to reload it again. | 82 // Try to reload it again. |
| 83 web_contents->GetController().Reload(true); | 83 web_contents->GetController().Reload(true); |
| 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::Source<content::NavigationController> source(&controller); | 88 content::Source<content::NavigationController> source(&controller); |
| 89 content::TestNavigationObserver navigation_observer(source); | 89 content::TestNavigationObserver navigation_observer(source); |
| 90 browser()->OpenURL(content::OpenURLParams( | 90 browser()->OpenURL(content::OpenURLParams( |
| 91 test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB, | 91 test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB, |
| 92 content::PAGE_TRANSITION_TYPED, false)); | 92 content::PAGE_TRANSITION_TYPED, false)); |
| 93 navigation_observer.Wait(); | 93 navigation_observer.Wait(); |
| 94 } | 94 } |
| OLD | NEW |