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

Side by Side Diff: chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc

Issue 981243003: Make commands consistent across security interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests must return ints 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/ssl/captive_portal_blocking_page.h" 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 bool IsInterstitialDisplayingText(content::InterstitialPage* interstitial, 34 bool IsInterstitialDisplayingText(content::InterstitialPage* interstitial,
35 const std::string& text) { 35 const std::string& text) {
36 // It's valid for |text| to contain "\'", but simply look for "'" instead 36 // It's valid for |text| to contain "\'", but simply look for "'" instead
37 // since this function is used for searching host names and a predefined 37 // since this function is used for searching host names and a predefined
38 // string. 38 // string.
39 DCHECK(text.find("\'") == std::string::npos); 39 DCHECK(text.find("\'") == std::string::npos);
40 std::string command = base::StringPrintf( 40 std::string command = base::StringPrintf(
41 "var hasText = document.body.textContent.indexOf('%s') >= 0;" 41 "var hasText = document.body.textContent.indexOf('%s') >= 0;"
42 "window.domAutomationController.send(hasText);", 42 "window.domAutomationController.send(hasText);",
43 text.c_str()); 43 text.c_str());
44 bool result = false; 44 int result = 0;
45 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 45 EXPECT_EQ(1, content::ExecuteScriptAndExtractInt(
meacer 2015/03/07 07:50:59 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(..
46 interstitial->GetMainFrame(), command, &result)); 46 interstitial->GetMainFrame(), command, &result));
47 return result; 47 return result == 1;
48 } 48 }
49 49
50 enum ExpectWiFi { 50 enum ExpectWiFi {
51 EXPECT_WIFI_NO, 51 EXPECT_WIFI_NO,
52 EXPECT_WIFI_YES 52 EXPECT_WIFI_YES
53 }; 53 };
54 54
55 enum ExpectWiFiSSID { 55 enum ExpectWiFiSSID {
56 EXPECT_WIFI_SSID_NO, 56 EXPECT_WIFI_SSID_NO,
57 EXPECT_WIFI_SSID_YES 57 EXPECT_WIFI_SSID_YES
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 const char kHostnameJSUnicode[] = 239 const char kHostnameJSUnicode[] =
240 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442." 240 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442."
241 "\\u0440\\u0444"; 241 "\\u0440\\u0444";
242 std::string landing_url_spec = 242 std::string landing_url_spec =
243 base::StringPrintf("http://%s/landing_url", kHostname); 243 base::StringPrintf("http://%s/landing_url", kHostname);
244 GURL landing_url(landing_url_spec); 244 GURL landing_url(landing_url_spec);
245 245
246 TestInterstitial(false, "", landing_url, EXPECT_WIFI_NO, EXPECT_WIFI_SSID_NO, 246 TestInterstitial(false, "", landing_url, EXPECT_WIFI_NO, EXPECT_WIFI_SSID_NO,
247 EXPECT_LOGIN_URL_YES, kHostnameJSUnicode); 247 EXPECT_LOGIN_URL_YES, kHostnameJSUnicode);
248 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698