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

Unified Diff: chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc

Issue 872993003: Distinguish between wired and wifi connections in the captive portal interstitial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment about the accuracy of GetConnectionType Created 5 years, 11 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 | « chrome/browser/ssl/captive_portal_blocking_page.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
diff --git a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
index a5d34836d0eff82fc0d60e11f663d28958e7f42d..73de3c8843e4f1438e9b024c3a7bef841ece6c12 100644
--- a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
+++ b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
@@ -53,6 +53,48 @@ class CaptivePortalBlockingPageTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(CaptivePortalBlockingPageTest);
};
+// If the connection is not a Wi-Fi connection, the wired network version of the
+// captive portal interstitial should be displayed.
+IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest,
+ ShowWiredNetworkInterstitial) {
+ const GURL kLandingUrl("http://captive.portal/landing_url");
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ DCHECK(contents);
+ // Blocking page is owned by the interstitial.
+ CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
+ contents, GURL(kBrokenSSL), kLandingUrl, base::Callback<void(bool)>());
+ blocking_page->SetWiFiConnectionForTesting(false);
+ blocking_page->Show();
+
+ WaitForInterstitialAttach(contents);
+ EXPECT_TRUE(
+ WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame()));
+ EXPECT_FALSE(
+ IsInterstitialDisplayingText(contents->GetInterstitialPage(), "Wi-Fi"));
+}
+
+// If the connection is a Wi-Fi connection, the Wi-Fi version of the captive
+// portal interstitial should be displayed.
+IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest,
+ ShowWiFiInterstitial) {
+ const GURL kLandingUrl("http://captive.portal/landing_url");
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ DCHECK(contents);
+ // Blocking page is owned by the interstitial.
+ CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
+ contents, GURL(kBrokenSSL), kLandingUrl, base::Callback<void(bool)>());
+ blocking_page->SetWiFiConnectionForTesting(true);
+ blocking_page->Show();
+
+ WaitForInterstitialAttach(contents);
+ EXPECT_TRUE(
+ WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame()));
+ EXPECT_TRUE(
+ IsInterstitialDisplayingText(contents->GetInterstitialPage(), "Wi-Fi"));
+}
+
// The captive portal interstitial should show the login url if the login url
// is different than the captive portal ping url (i.e. the portal intercepts
// requests via HTTP redirects).
@@ -65,6 +107,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest,
// Blocking page is owned by the interstitial.
CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
contents, GURL(kBrokenSSL), kLandingUrl, base::Callback<void(bool)>());
+ blocking_page->SetWiFiConnectionForTesting(false);
blocking_page->Show();
WaitForInterstitialAttach(contents);
@@ -89,6 +132,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest,
// Blocking page is owned by the interstitial.
CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
contents, GURL(kBrokenSSL), kLandingUrl, base::Callback<void(bool)>());
+ blocking_page->SetWiFiConnectionForTesting(false);
blocking_page->Show();
WaitForInterstitialAttach(contents);
@@ -130,6 +174,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest,
// Blocking page is owned by the interstitial.
CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
contents, GURL(kBrokenSSL), landing_url, base::Callback<void(bool)>());
+ blocking_page->SetWiFiConnectionForTesting(false);
blocking_page->Show();
WaitForInterstitialAttach(contents);
« no previous file with comments | « chrome/browser/ssl/captive_portal_blocking_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698