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

Unified Diff: ios/web/web_state/js/crw_js_window_id_manager_unittest.mm

Issue 2192503002: [ios] Cleaned up UIWebView workarounds from window_id.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/CRWJSWindowIdManager/CRWJSWindowIDManager Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/web/web_state/js/resources/window_id.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/js/crw_js_window_id_manager_unittest.mm
diff --git a/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm b/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm
index 9261e6db41cfa425478879d016162104239eda1b..98766d090b2b7982de34a310ae4e18878f24753b 100644
--- a/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm
+++ b/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm
@@ -7,6 +7,7 @@
#import <WebKit/WebKit.h>
#import "ios/web/public/test/js_test_util.h"
+#import "ios/web/web_state/js/page_script_util.h"
#import "testing/gtest_mac.h"
namespace web {
@@ -16,7 +17,7 @@ namespace web {
TEST(JSWindowIDManagerTest, WindowIDDifferentManager) {
// Inject the first manager.
WKWebView* web_view = [[[WKWebView alloc] init] autorelease];
- EvaluateJavaScript(web_view, @"window.__gCrWeb = {};");
+ EvaluateJavaScript(web_view, GetEarlyPageScript());
CRWJSWindowIDManager* manager =
[[[CRWJSWindowIDManager alloc] initWithWebView:web_view] autorelease];
@@ -26,7 +27,7 @@ TEST(JSWindowIDManagerTest, WindowIDDifferentManager) {
// Inject the second manager.
WKWebView* web_view2 = [[[WKWebView alloc] init] autorelease];
- EvaluateJavaScript(web_view2, @"window.__gCrWeb = {};");
+ EvaluateJavaScript(web_view2, GetEarlyPageScript());
CRWJSWindowIDManager* manager2 =
[[[CRWJSWindowIDManager alloc] initWithWebView:web_view2] autorelease];
@@ -41,7 +42,7 @@ TEST(JSWindowIDManagerTest, WindowIDDifferentManager) {
// Tests that injecting multiple times creates a new window ID.
TEST(JSWindowIDManagerTest, MultipleInjections) {
WKWebView* web_view = [[[WKWebView alloc] init] autorelease];
- EvaluateJavaScript(web_view, @"window.__gCrWeb = {};");
+ EvaluateJavaScript(web_view, GetEarlyPageScript());
// First injection.
CRWJSWindowIDManager* manager =
@@ -70,7 +71,7 @@ TEST(JSWindowIDManagerTest, InjectionRetry) {
EXPECT_FALSE(EvaluateJavaScript(web_view, @"window.__gCrWeb"));
// Now inject window.__gCrWeb and check if window ID injection retried.
- EvaluateJavaScript(web_view, @"window.__gCrWeb = {};");
+ EvaluateJavaScript(web_view, GetEarlyPageScript());
EXPECT_NSEQ([manager windowID],
EvaluateJavaScript(web_view, @"window.__gCrWeb.windowId"));
}
« no previous file with comments | « no previous file | ios/web/web_state/js/resources/window_id.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698