This source file includes following definitions.
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/net/url_fixer_upper.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
using web_modal::WebContentsModalDialogManager;
typedef InProcessBrowserTest RepostFormWarningTest;
IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestDoubleReload) {
ASSERT_TRUE(test_server()->Start());
ui_test_utils::NavigateToURL(
browser(), test_server()->GetURL("files/form.html"));
ui_test_utils::NavigateToURL(
browser(),
GURL("javascript:document.getElementById('form').submit()"));
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
web_contents->GetController().Reload(true);
web_contents->GetController().Reload(true);
WebContentsModalDialogManager* web_contents_modal_dialog_manager =
WebContentsModalDialogManager::FromWebContents(web_contents);
EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive());
ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("bar"));
EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
}
IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) {
ASSERT_TRUE(test_server()->Start());
ui_test_utils::NavigateToURL(
browser(), test_server()->GetURL("files/form.html"));
ui_test_utils::NavigateToURL(
browser(),
GURL("javascript:document.getElementById('form').submit()"));
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
web_contents->GetController().Reload(true);
content::NavigationController& controller = web_contents->GetController();
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_AUTH_NEEDED,
content::Source<content::NavigationController>(&controller));
browser()->OpenURL(content::OpenURLParams(
test_server()->GetURL("auth-basic"), content::Referrer(), CURRENT_TAB,
content::PAGE_TRANSITION_TYPED, false));
observer.Wait();
web_contents->GetController().Reload(true);
content::TestNavigationObserver navigation_observer(web_contents);
browser()->OpenURL(content::OpenURLParams(
test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB,
content::PAGE_TRANSITION_TYPED, false));
navigation_observer.Wait();
}