OLD | NEW |
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 "ios/web/public/test/test_browser_state.h" | 10 #include "ios/web/public/test/test_browser_state.h" |
11 #include "ios/web/public/test/web_test_util.h" | 11 #include "ios/web/public/test/web_test_util.h" |
12 #include "ios/web/public/web_client.h" | 12 #include "ios/web/public/web_client.h" |
13 #import "ios/web/web_state/js/page_script_util.h" | 13 #import "ios/web/web_state/js/page_script_util.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "testing/gtest_mac.h" | 15 #include "testing/gtest_mac.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | |
16 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
17 | 17 |
18 namespace web { | 18 namespace web { |
19 namespace { | 19 namespace { |
20 | 20 |
21 class WKWebViewConfigurationProviderTest : public PlatformTest { | 21 class WKWebViewConfigurationProviderTest : public PlatformTest { |
22 protected: | 22 protected: |
23 void SetUp() override { | 23 void SetUp() override { |
24 PlatformTest::SetUp(); | 24 PlatformTest::SetUp(); |
25 SetWebClient(&web_client_); | 25 SetWebClient(&web_client_); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 NSArray* scripts = config.userContentController.userScripts; | 145 NSArray* scripts = config.userContentController.userScripts; |
146 EXPECT_EQ(1U, scripts.count); | 146 EXPECT_EQ(1U, scripts.count); |
147 NSString* early_script = GetEarlyPageScript(WK_WEB_VIEW_TYPE); | 147 NSString* early_script = GetEarlyPageScript(WK_WEB_VIEW_TYPE); |
148 // |earlyScript| is a substring of |userScripts|. The latter wraps the | 148 // |earlyScript| is a substring of |userScripts|. The latter wraps the |
149 // former with "if (!injected)" check to avoid double injections. | 149 // former with "if (!injected)" check to avoid double injections. |
150 EXPECT_LT(0U, [[scripts[0] source] rangeOfString:early_script].length); | 150 EXPECT_LT(0U, [[scripts[0] source] rangeOfString:early_script].length); |
151 } | 151 } |
152 | 152 |
153 } // namespace | 153 } // namespace |
154 } // namespace web | 154 } // namespace web |
OLD | NEW |