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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page_test_utils.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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
6
7 #include <string>
8
9 #include "base/strings/stringprintf.h"
10 #include "content/public/browser/interstitial_page.h"
11 #include "content/public/test/browser_test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace chrome_browser_interstitials {
15
16 bool IsInterstitialDisplayingText(content::InterstitialPage* interstitial,
17 const std::string& text) {
18 // It's valid for |text| to contain "\'", but simply look for "'" instead
19 // since this function is used for searching host names and a predefined
20 // string.
21 DCHECK(text.find("\'") == std::string::npos);
22 std::string command = base::StringPrintf(
23 "var hasText = document.body.textContent.indexOf('%s') >= 0;"
24 "window.domAutomationController.send(hasText ? 1 : 0);",
25 text.c_str());
26 int result = 0;
27 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(interstitial->GetMainFrame(),
28 command, &result));
29 return result == 1;
30 }
31
32 } // namespace chrome_browser_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698