| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome/browser/find_in_page/js_findinpage_manager.h" | 5 #import "ios/chrome/browser/find_in_page/js_findinpage_manager.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #import "ios/chrome/browser/web/chrome_web_test.h" | 10 #import "ios/chrome/browser/web/chrome_web_test.h" |
| 11 #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" |
| 12 #import "ios/web/public/web_state/web_state.h" | 12 #import "ios/web/public/web_state/web_state.h" |
| 13 #import "testing/gtest_mac.h" | 13 #import "testing/gtest_mac.h" |
| 14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
| 15 // Test fixture to test Find In Page JS. | 19 // Test fixture to test Find In Page JS. |
| 16 class JsFindinpageManagerTest : public ChromeWebTest { | 20 class JsFindinpageManagerTest : public ChromeWebTest { |
| 17 protected: | 21 protected: |
| 18 // Loads the given HTML and initializes the findInPage JS scripts. | 22 // Loads the given HTML and initializes the findInPage JS scripts. |
| 19 void LoadHtml(NSString* html) { | 23 void LoadHtml(NSString* html) { |
| 20 ChromeWebTest::LoadHtml(html); | 24 ChromeWebTest::LoadHtml(html); |
| 21 manager_ = | 25 manager_ = |
| 22 static_cast<JsFindinpageManager*>([web_state()->GetJSInjectionReceiver() | 26 static_cast<JsFindinpageManager*>([web_state()->GetJSInjectionReceiver() |
| 23 instanceOfClass:[JsFindinpageManager class]]); | 27 instanceOfClass:[JsFindinpageManager class]]); |
| 24 [manager_ inject]; | 28 [manager_ inject]; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 EXPECT_NSNE(@YES, result); | 75 EXPECT_NSNE(@YES, result); |
| 72 completion_handler_block_was_called = YES; | 76 completion_handler_block_was_called = YES; |
| 73 }]; | 77 }]; |
| 74 }; | 78 }; |
| 75 [manager_ findString:@"');token=true;('" | 79 [manager_ findString:@"');token=true;('" |
| 76 completionHandler:completion_handler_block]; | 80 completionHandler:completion_handler_block]; |
| 77 base::test::ios::WaitUntilCondition(^bool() { | 81 base::test::ios::WaitUntilCondition(^bool() { |
| 78 return completion_handler_block_was_called; | 82 return completion_handler_block_was_called; |
| 79 }); | 83 }); |
| 80 } | 84 } |
| OLD | NEW |