| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/public/web_state/js/crw_js_injection_manager.h" | 5 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "ios/web/public/test/web_test_with_web_state.h" |
| 10 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 11 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| 11 #import "ios/web/public/web_state/web_state.h" | 12 #import "ios/web/public/web_state/web_state.h" |
| 12 #import "ios/web/test/web_test.h" | |
| 13 #include "testing/gtest_mac.h" | 13 #include "testing/gtest_mac.h" |
| 14 | 14 |
| 15 // Testing class of JsInjectioManager that has no dependencies. | 15 // Testing class of JsInjectioManager that has no dependencies. |
| 16 @interface TestingCRWJSBaseManager : CRWJSInjectionManager | 16 @interface TestingCRWJSBaseManager : CRWJSInjectionManager |
| 17 @end | 17 @end |
| 18 | 18 |
| 19 @implementation TestingCRWJSBaseManager | 19 @implementation TestingCRWJSBaseManager |
| 20 | 20 |
| 21 - (NSString*)presenceBeacon { | 21 - (NSString*)presenceBeacon { |
| 22 return @"base"; | 22 return @"base"; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 ]; | 151 ]; |
| 152 } | 152 } |
| 153 | 153 |
| 154 @end | 154 @end |
| 155 | 155 |
| 156 #pragma mark - | 156 #pragma mark - |
| 157 | 157 |
| 158 namespace web { | 158 namespace web { |
| 159 | 159 |
| 160 // Test fixture to test web controller injection. | 160 // Test fixture to test web controller injection. |
| 161 class JsInjectionManagerTest : public web::WebTestWithWebController { | 161 class JsInjectionManagerTest : public web::WebTestWithWebState { |
| 162 protected: | 162 protected: |
| 163 void SetUp() override { | 163 void SetUp() override { |
| 164 web::WebTestWithWebController::SetUp(); | 164 web::WebTestWithWebState::SetUp(); |
| 165 // Loads a dummy page to prepare JavaScript evaluation. | 165 // Loads a dummy page to prepare JavaScript evaluation. |
| 166 NSString* const kPageContent = @"<html><body><div></div></body></html>"; | 166 NSString* const kPageContent = @"<html><body><div></div></body></html>"; |
| 167 LoadHtml(kPageContent); | 167 LoadHtml(kPageContent); |
| 168 } | 168 } |
| 169 // Returns the manager of the given class. | 169 // Returns the manager of the given class. |
| 170 CRWJSInjectionManager* GetInstanceOfClass(Class jsInjectionManagerClass); | 170 CRWJSInjectionManager* GetInstanceOfClass(Class jsInjectionManagerClass); |
| 171 // Returns true if the receiver_ has all the managers in |managers|. | 171 // Returns true if the receiver_ has all the managers in |managers|. |
| 172 bool HasReceiverManagers(NSArray* managers); | 172 bool HasReceiverManagers(NSArray* managers); |
| 173 // EXPECTs that |actual| consists of the CRWJSInjectionManagers of the | 173 // EXPECTs that |actual| consists of the CRWJSInjectionManagers of the |
| 174 // expected classes in a correct order. | 174 // expected classes in a correct order. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 @[ | 302 @[ |
| 303 [TestingCRWJSBaseManager class], [TestingAnotherCRWJSBaseManager class], | 303 [TestingCRWJSBaseManager class], [TestingAnotherCRWJSBaseManager class], |
| 304 [TestingJsManager class], [TestingAnotherJsManager class], | 304 [TestingJsManager class], [TestingAnotherJsManager class], |
| 305 [TestingJsManagerWithNestedDependencies class], | 305 [TestingJsManagerWithNestedDependencies class], |
| 306 [TestingJsManagerComplex class] | 306 [TestingJsManagerComplex class] |
| 307 ], | 307 ], |
| 308 list); | 308 list); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace web | 311 } // namespace web |
| OLD | NEW |