Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: chrome/browser/ui/login/login_prompt_browsertest.cc

Issue 397453002: Add test case to see if HTTP auth interstitials work nicely with other interstitials (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: msw comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/login/login_prompt_browsertest.cc
diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc
index fea1db6406e7f740736bfe1e4673c519a2de5169..004f68dd8402a15d4b5dd567e0d2835d103fed8f 100644
--- a/chrome/browser/ui/login/login_prompt_browsertest.cc
+++ b/chrome/browser/ui/login/login_prompt_browsertest.cc
@@ -25,6 +25,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "net/base/auth.h"
#include "net/dns/mock_host_resolver.h"
+#include "net/test/spawned_test_server/spawned_test_server.h"
using content::NavigationController;
using content::OpenURLParams;
@@ -1249,4 +1250,61 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest,
TestCrossOriginPrompt(test_page, auth_host);
}
+IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest,
+ LoginInterstitialShouldReplaceExistingInterstitial) {
+ net::SpawnedTestServer https_server(
+ net::SpawnedTestServer::TYPE_HTTPS,
+ net::SpawnedTestServer::SSLOptions(
+ net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
+ base::FilePath());
+ ASSERT_TRUE(https_server.Start());
+
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ NavigationController* controller = &contents->GetController();
+ LoginPromptBrowserTestObserver observer;
+
+ observer.Register(content::Source<NavigationController>(controller));
+
+ // Load a page which triggers an SSL interstitial. Proceeding through it
+ // should show the login page with the blank interstitial.
+ {
+ GURL test_page = https_server.GetURL(kAuthBasicPage);
+ ASSERT_EQ("127.0.0.1", test_page.host());
+
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+ browser()->OpenURL(OpenURLParams(
+ test_page, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED,
+ false));
+ ASSERT_EQ("127.0.0.1", contents->GetURL().host());
+ WaitForInterstitialAttach(contents);
+
+ // An overrideable SSL interstitial is now being displayed. Proceed through
+ // the interstitial to see the login prompt.
+ contents->GetInterstitialPage()->Proceed();
+ auth_needed_waiter.Wait();
+ ASSERT_EQ(1u, observer.handlers().size());
+ WaitForInterstitialAttach(contents);
+
+ // The omnibox should show the correct origin while the login prompt is
+ // being displayed.
+ EXPECT_EQ("127.0.0.1", contents->GetVisibleURL().host());
+ EXPECT_TRUE(contents->ShowingInterstitialPage());
+
+ // Cancelling the login prompt should detach the interstitial while keeping
+ // the correct origin.
+ LoginHandler* handler = *observer.handlers().begin();
+ scoped_refptr<content::MessageLoopRunner> loop_runner(
+ new content::MessageLoopRunner);
+ InterstitialObserver interstitial_observer(contents,
+ base::Closure(),
+ loop_runner->QuitClosure());
+ handler->CancelAuth();
+ if (content::InterstitialPage::GetInterstitialPage(contents))
+ loop_runner->Run();
+ EXPECT_EQ("127.0.0.1", contents->GetVisibleURL().host());
+ EXPECT_FALSE(contents->ShowingInterstitialPage());
+ }
+}
+
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698