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

Unified Diff: components/autofill/core/browser/autofill_external_delegate_unittest.cc

Issue 148413002: Add "previewing on hover" support for single-field autocomplete input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per review comments Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_external_delegate_unittest.cc
diff --git a/components/autofill/core/browser/autofill_external_delegate_unittest.cc b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
index ad86d836bebc462876e46505413897ae12815aec..145c684eb4d904517f6c7e016897562421316af4 100644
--- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc
+++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
@@ -45,6 +45,8 @@ class MockAutofillDriver : public TestAutofillDriver {
void(const base::string16&));
MOCK_METHOD0(RendererShouldClearFilledForm, void());
MOCK_METHOD0(RendererShouldClearPreviewedForm, void());
+ MOCK_METHOD1(RendererShouldPreviewAutoCompleteNode,
+ void(const base::string16&));
MOCK_METHOD1(RendererShouldSetNodeText, void(const base::string16&));
private:
@@ -349,7 +351,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) {
EXPECT_CALL(*autofill_driver_,
SetRendererActionOnFormDataReception(_)).Times(0);
EXPECT_CALL(*autofill_driver_, RendererShouldClearPreviewedForm()).Times(1);
- external_delegate_->DidSelectSuggestion(-1);
+ external_delegate_->DidSelectSuggestion(-1, ASCIIToUTF16(""));
Ilya Sherman 2014/02/22 05:59:51 nit: Prefer "base::string16()" to "ASCIIToUTF16(""
ziran.sun 2014/02/27 15:38:11 Done.
// Ensure it doesn't try to fill the form in with the negative id.
EXPECT_CALL(manager_delegate_, HideAutofillPopup());
@@ -369,12 +371,18 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateClearPreviewedForm) {
// cause any previews to get cleared.
EXPECT_CALL(*autofill_driver_, RendererShouldClearPreviewedForm()).Times(1);
external_delegate_->DidSelectSuggestion(
- WebAutofillClient::MenuItemIDPasswordEntry);
+ WebAutofillClient::MenuItemIDPasswordEntry, ASCIIToUTF16("baz foo"));
EXPECT_CALL(*autofill_driver_, RendererShouldClearPreviewedForm()).Times(1);
EXPECT_CALL(*autofill_driver_, SetRendererActionOnFormDataReception(
AutofillDriver::FORM_DATA_ACTION_PREVIEW));
- external_delegate_->DidSelectSuggestion(1);
+ external_delegate_->DidSelectSuggestion(1, ASCIIToUTF16("baz foo"));
+
+ // Ensure selecting an AutoComplete entries will cause any previews to
Ilya Sherman 2014/02/22 05:59:51 nit: "an AutoComplete entries" -> "an autocomplete
ziran.sun 2014/02/27 15:38:11 Done.
+ // get cleared.
+ EXPECT_CALL(*autofill_driver_, RendererShouldClearPreviewedForm()).Times(1);
+ external_delegate_->DidSelectSuggestion(
+ WebAutofillClient::MenuItemIDAutocompleteEntry, ASCIIToUTF16("baz foo"));
}
// Test that the popup is hidden once we are done editing the autofill field.

Powered by Google App Engine
This is Rietveld 408576698