| 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/autofill/form_suggestion_controller.h" | 5 #import "ios/chrome/browser/autofill/form_suggestion_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 [[[mock_web_view_proxy_ stub] andReturn:input_accessory_view_] | 150 [[[mock_web_view_proxy_ stub] andReturn:input_accessory_view_] |
| 151 keyboardAccessory]; | 151 keyboardAccessory]; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void TearDown() override { | 154 void TearDown() override { |
| 155 [suggestion_controller_ detachFromWebState]; | 155 [suggestion_controller_ detachFromWebState]; |
| 156 ChromeWebTest::TearDown(); | 156 ChromeWebTest::TearDown(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Sets |url| to be current for WebState. | 159 // Sets |url| to be current for WebState. |
| 160 void SetCurrentUrl(const std::string& url) { LoadHtml(@"", GURL(url)); } | 160 void SetCurrentUrl(const std::string& url) { |
| 161 LoadHtml(@"<html></html>", GURL(url)); |
| 162 } |
| 161 | 163 |
| 162 // Swizzles the current web controller to set whether the content is HTML. | 164 // Swizzles the current web controller to set whether the content is HTML. |
| 163 void SetContentIsHtml(BOOL content_is_html) { | 165 void SetContentIsHtml(BOOL content_is_html) { |
| 164 id content_is_html_block = ^BOOL(CRWWebController* webController) { | 166 id content_is_html_block = ^BOOL(CRWWebController* webController) { |
| 165 return content_is_html; | 167 return content_is_html; |
| 166 }; | 168 }; |
| 167 content_is_html_swizzler_.reset(new ScopedBlockSwizzler( | 169 content_is_html_swizzler_.reset(new ScopedBlockSwizzler( |
| 168 [CRWWebController class], @selector(contentIsHTML), | 170 [CRWWebController class], @selector(contentIsHTML), |
| 169 content_is_html_block)); | 171 content_is_html_block)); |
| 170 } | 172 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 432 |
| 431 // Selecting a suggestion should notify the delegate. | 433 // Selecting a suggestion should notify the delegate. |
| 432 [suggestion_controller_ didSelectSuggestion:suggestions[0]]; | 434 [suggestion_controller_ didSelectSuggestion:suggestions[0]]; |
| 433 EXPECT_TRUE([provider selected]); | 435 EXPECT_TRUE([provider selected]); |
| 434 EXPECT_NSEQ(@"form", [provider formName]); | 436 EXPECT_NSEQ(@"form", [provider formName]); |
| 435 EXPECT_NSEQ(@"field", [provider fieldName]); | 437 EXPECT_NSEQ(@"field", [provider fieldName]); |
| 436 EXPECT_NSEQ(suggestions[0], [provider suggestion]); | 438 EXPECT_NSEQ(suggestions[0], [provider suggestion]); |
| 437 } | 439 } |
| 438 | 440 |
| 439 } // namespace | 441 } // namespace |
| OLD | NEW |