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

Side by Side Diff: ios/web/web_state/ui/wk_web_view_configuration_provider_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
« no previous file with comments | « ios/web/web_state/ui/wk_web_view_configuration_provider.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" 5 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import "base/ios/weak_nsobject.h" 9 #import "base/ios/weak_nsobject.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 EXPECT_FALSE(config); 130 EXPECT_FALSE(config);
131 EXPECT_FALSE(router); 131 EXPECT_FALSE(router);
132 } 132 }
133 133
134 // Tests that configuration's userContentController has only one script with the 134 // Tests that configuration's userContentController has only one script with the
135 // same content as web::GetEarlyPageScript() returns. 135 // same content as web::GetEarlyPageScript() returns.
136 TEST_F(WKWebViewConfigurationProviderTest, UserScript) { 136 TEST_F(WKWebViewConfigurationProviderTest, UserScript) {
137 WKWebViewConfiguration* config = GetProvider().GetWebViewConfiguration(); 137 WKWebViewConfiguration* config = GetProvider().GetWebViewConfiguration();
138 NSArray* scripts = config.userContentController.userScripts; 138 NSArray* scripts = config.userContentController.userScripts;
139 EXPECT_EQ(1U, scripts.count); 139 EXPECT_EQ(1U, scripts.count);
140 NSString* early_script = GetEarlyPageScript(); 140 NSString* early_script = GetEarlyPageScript(&browser_state_);
141 // |earlyScript| is a substring of |userScripts|. The latter wraps the 141 // |earlyScript| is a substring of |userScripts|. The latter wraps the
142 // former with "if (!injected)" check to avoid double injections. 142 // former with "if (!injected)" check to avoid double injections.
143 EXPECT_LT(0U, [[scripts[0] source] rangeOfString:early_script].length); 143 EXPECT_LT(0U, [[scripts[0] source] rangeOfString:early_script].length);
144 } 144 }
145 145
146 } // namespace 146 } // namespace
147 } // namespace web 147 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/wk_web_view_configuration_provider.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698