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

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

Issue 1000333003: Properly decode IDN in interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 ec7402c4aab6ec90f242dfee36ab86105715f7cd..9be2ce7bf98fc27acb57c786bdf9b50c40d58266 100644
--- a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
+++ b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/prefs/pref_service.h"
#include "base/strings/stringprintf.h"
+#include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -23,6 +24,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+using chrome_browser_interstitials::IsInterstitialDisplayingText;
+
namespace {
// Partial text in the captive portal interstitial's main paragraph when the
// login domain isn't displayed.
@@ -30,23 +33,6 @@ const char kGenericLoginURLText[] = "its login page";
const char kBrokenSSL[] = "https://broken.ssl";
const char kWiFiSSID[] = "WiFiSSID";
-// Returns true if the interstitial contains |text| in its body.
-bool IsInterstitialDisplayingText(content::InterstitialPage* interstitial,
- const std::string& text) {
- // It's valid for |text| to contain "\'", but simply look for "'" instead
- // since this function is used for searching host names and a predefined
- // string.
- DCHECK(text.find("\'") == std::string::npos);
- std::string command = base::StringPrintf(
- "var hasText = document.body.textContent.indexOf('%s') >= 0;"
- "window.domAutomationController.send(hasText ? 1 : 0);",
- text.c_str());
- int result = 0;
- EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
- interstitial->GetMainFrame(), command, &result));
- return result == 1;
-}
-
enum ExpectWiFi {
EXPECT_WIFI_NO,
EXPECT_WIFI_YES

Powered by Google App Engine
This is Rietveld 408576698