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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page_test_utils.cc

Issue 2603433002: Move SecurityInterstitialPage into component (Closed)
Patch Set: missed some changes in rebase Created 3 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 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/interstitials/security_interstitial_page_test_utils.h" 5 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/interstitials/security_interstitial_page.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
15 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
15 #include "components/security_interstitials/content/security_interstitial_page.h "
16 #include "components/security_interstitials/core/controller_client.h" 16 #include "components/security_interstitials/core/controller_client.h"
17 #include "content/public/browser/interstitial_page.h" 17 #include "content/public/browser/interstitial_page.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 namespace chrome_browser_interstitials { 23 namespace chrome_browser_interstitials {
24 24
25 bool IsInterstitialDisplayingText( 25 bool IsInterstitialDisplayingText(
(...skipping 24 matching lines...) Expand all
50 const char kHostname[] = "xn--d1abbgf6aiiy.xn--p1ai"; 50 const char kHostname[] = "xn--d1abbgf6aiiy.xn--p1ai";
51 const char kHostnameJSUnicode[] = 51 const char kHostnameJSUnicode[] =
52 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442." 52 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442."
53 "\\u0440\\u0444"; 53 "\\u0440\\u0444";
54 std::string request_url_spec = base::StringPrintf("https://%s/", kHostname); 54 std::string request_url_spec = base::StringPrintf("https://%s/", kHostname);
55 GURL request_url(request_url_spec); 55 GURL request_url(request_url_spec);
56 56
57 content::WebContents* contents = 57 content::WebContents* contents =
58 browser()->tab_strip_model()->GetActiveWebContents(); 58 browser()->tab_strip_model()->GetActiveWebContents();
59 DCHECK(contents); 59 DCHECK(contents);
60 SecurityInterstitialPage* blocking_page = 60 security_interstitials::SecurityInterstitialPage* blocking_page =
61 CreateInterstitial(contents, request_url); 61 CreateInterstitial(contents, request_url);
62 blocking_page->Show(); 62 blocking_page->Show();
63 63
64 WaitForInterstitialAttach(contents); 64 WaitForInterstitialAttach(contents);
65 if (!WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())) 65 if (!WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame()))
66 return testing::AssertionFailure() << "Render frame not ready"; 66 return testing::AssertionFailure() << "Render frame not ready";
67 67
68 if (IsInterstitialDisplayingText(contents->GetInterstitialPage(), 68 if (IsInterstitialDisplayingText(contents->GetInterstitialPage(),
69 kHostnameJSUnicode)) { 69 kHostnameJSUnicode)) {
70 return testing::AssertionSuccess(); 70 return testing::AssertionSuccess();
71 } 71 }
72 return testing::AssertionFailure() << "Interstitial not displaying text"; 72 return testing::AssertionFailure() << "Interstitial not displaying text";
73 } 73 }
74 } // namespace chrome_browser_interstitials 74 } // namespace chrome_browser_interstitials
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/security_interstitial_page_test_utils.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698