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

Side by Side Diff: ios/web/web_state/js/page_script_util_unittest.mm

Issue 2605913002: Fix include import in ios/web (Closed)
Patch Set: add missing #import 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 #import "ios/web/web_state/js/page_script_util.h" 5 #import "ios/web/web_state/js/page_script_util.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #import "base/test/ios/wait_util.h" 12 #import "base/test/ios/wait_util.h"
13 #import "ios/web/public/test/js_test_util.h" 13 #import "ios/web/public/test/js_test_util.h"
14 #include "ios/web/public/test/test_browser_state.h" 14 #include "ios/web/public/test/test_browser_state.h"
15 #import "ios/web/public/test/test_web_client.h" 15 #import "ios/web/public/test/test_web_client.h"
16 #include "ios/web/public/test/web_test.h" 16 #include "ios/web/public/test/web_test.h"
17 #import "ios/web/public/web_view_creation_util.h" 17 #import "ios/web/public/web_view_creation_util.h"
18 #include "testing/gtest_mac.h" 18 #import "testing/gtest_mac.h"
19 19
20 namespace web { 20 namespace web {
21 namespace { 21 namespace {
22 22
23 // A test fixture for testing the page_script_util methods. 23 // A test fixture for testing the page_script_util methods.
24 typedef WebTest PageScriptUtilTest; 24 typedef WebTest PageScriptUtilTest;
25 25
26 // Tests that WKWebView early page script is a valid script that injects global 26 // Tests that WKWebView early page script is a valid script that injects global
27 // __gCrWeb object. 27 // __gCrWeb object.
28 TEST_F(PageScriptUtilTest, WKWebViewEarlyPageScript) { 28 TEST_F(PageScriptUtilTest, WKWebViewEarlyPageScript) {
29 WKWebView* web_view = BuildWKWebView(CGRectZero, GetBrowserState()); 29 WKWebView* web_view = BuildWKWebView(CGRectZero, GetBrowserState());
30 ExecuteJavaScript(web_view, GetEarlyPageScript()); 30 ExecuteJavaScript(web_view, GetEarlyPageScript());
31 EXPECT_NSEQ(@"object", ExecuteJavaScript(web_view, @"typeof __gCrWeb")); 31 EXPECT_NSEQ(@"object", ExecuteJavaScript(web_view, @"typeof __gCrWeb"));
32 } 32 }
33 33
34 // Tests that embedder's WKWebView script is included into early script. 34 // Tests that embedder's WKWebView script is included into early script.
35 TEST_F(PageScriptUtilTest, WKEmbedderScript) { 35 TEST_F(PageScriptUtilTest, WKEmbedderScript) {
36 GetWebClient()->SetEarlyPageScript(@"__gCrEmbedder = {};"); 36 GetWebClient()->SetEarlyPageScript(@"__gCrEmbedder = {};");
37 WKWebView* web_view = BuildWKWebView(CGRectZero, GetBrowserState()); 37 WKWebView* web_view = BuildWKWebView(CGRectZero, GetBrowserState());
38 ExecuteJavaScript(web_view, GetEarlyPageScript()); 38 ExecuteJavaScript(web_view, GetEarlyPageScript());
39 EXPECT_NSEQ(@"object", ExecuteJavaScript(web_view, @"typeof __gCrEmbedder")); 39 EXPECT_NSEQ(@"object", ExecuteJavaScript(web_view, @"typeof __gCrEmbedder"));
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 } // namespace web 43 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/js/page_script_util.mm ('k') | ios/web/web_state/ui/crw_generic_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698