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

Side by Side Diff: ios/chrome/browser/web/chrome_web_client_unittest.mm

Issue 2741343015: Add a BrowserState* parameter to GetEarlyPageScript(). (Closed)
Patch Set: Apply review comments. Created 3 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "ios/chrome/browser/web/chrome_web_client.h" 5 #include "ios/chrome/browser/web/chrome_web_client.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Tests that ChromeWebClient provides print script and does not provide 70 // Tests that ChromeWebClient provides print script and does not provide
71 // windowOpenFix script for WKWebView. 71 // windowOpenFix script for WKWebView.
72 TEST_F(ChromeWebClientTest, WKWebViewEarlyPageScript) { 72 TEST_F(ChromeWebClientTest, WKWebViewEarlyPageScript) {
73 // Chrome scripts rely on __gCrWeb object presence. 73 // Chrome scripts rely on __gCrWeb object presence.
74 web::TestBrowserState browser_state; 74 web::TestBrowserState browser_state;
75 WKWebView* web_view = web::BuildWKWebView(CGRectZero, &browser_state); 75 WKWebView* web_view = web::BuildWKWebView(CGRectZero, &browser_state);
76 web::ExecuteJavaScript(web_view, @"__gCrWeb = {};"); 76 web::ExecuteJavaScript(web_view, @"__gCrWeb = {};");
77 77
78 web::ScopedTestingWebClient web_client(base::MakeUnique<ChromeWebClient>()); 78 web::ScopedTestingWebClient web_client(base::MakeUnique<ChromeWebClient>());
79 NSString* script = web_client.Get()->GetEarlyPageScript(); 79 NSString* script = web_client.Get()->GetEarlyPageScript(&browser_state);
80 web::ExecuteJavaScript(web_view, script); 80 web::ExecuteJavaScript(web_view, script);
81 EXPECT_NSEQ(@"object", 81 EXPECT_NSEQ(@"object",
82 web::ExecuteJavaScript(web_view, @"typeof __gCrWeb.print")); 82 web::ExecuteJavaScript(web_view, @"typeof __gCrWeb.print"));
83 EXPECT_NSEQ(@"undefined", web::ExecuteJavaScript( 83 EXPECT_NSEQ(@"undefined", web::ExecuteJavaScript(
84 web_view, @"typeof __gCrWeb.windowOpenFix")); 84 web_view, @"typeof __gCrWeb.windowOpenFix"));
85 } 85 }
86 86
87 } // namespace 87 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/chrome_web_client.mm ('k') | ios/chrome/browser/web/early_page_script_perftest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698