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

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

Issue 306053008: Rename AutofillManagerDelegate to AutofillClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 8d002805744358cb7270091cc49008fb3b303ebe..494bbbbb7d4079741bfc7c851a0515157e5d7ca4 100644
--- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc
+++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
@@ -10,9 +10,9 @@
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/popup_item_ids.h"
+#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_autofill_driver.h"
#include "components/autofill/core/browser/test_autofill_external_delegate.h"
-#include "components/autofill/core/browser/test_autofill_manager_delegate.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/password_form_fill_data.h"
@@ -49,10 +49,9 @@ class MockAutofillDriver : public TestAutofillDriver {
DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver);
};
-class MockAutofillManagerDelegate
- : public autofill::TestAutofillManagerDelegate {
+class MockAutofillClient : public autofill::TestAutofillClient {
public:
- MockAutofillManagerDelegate() {}
+ MockAutofillClient() {}
MOCK_METHOD7(ShowAutofillPopup,
void(const gfx::RectF& element_bounds,
@@ -70,17 +69,15 @@ class MockAutofillManagerDelegate
MOCK_METHOD0(HideAutofillPopup, void());
private:
- DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate);
+ DISALLOW_COPY_AND_ASSIGN(MockAutofillClient);
};
class MockAutofillManager : public AutofillManager {
public:
- MockAutofillManager(AutofillDriver* driver,
- MockAutofillManagerDelegate* delegate)
+ MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client)
// Force to use the constructor designated for unit test, but we don't
// really need personal_data in this test so we pass a NULL pointer.
- : AutofillManager(driver, delegate, NULL) {
- }
+ : AutofillManager(driver, client, NULL) {}
virtual ~MockAutofillManager() {}
MOCK_METHOD5(FillOrPreviewForm,
@@ -101,8 +98,7 @@ class AutofillExternalDelegateUnitTest : public testing::Test {
virtual void SetUp() OVERRIDE {
autofill_driver_.reset(new MockAutofillDriver());
autofill_manager_.reset(
- new MockAutofillManager(autofill_driver_.get(),
- &manager_delegate_));
+ new MockAutofillManager(autofill_driver_.get(), &autofill_client_));
external_delegate_.reset(
new AutofillExternalDelegate(
autofill_manager_.get(), autofill_driver_.get()));
@@ -127,7 +123,7 @@ class AutofillExternalDelegateUnitTest : public testing::Test {
external_delegate_->OnQuery(query_id, form, field, element_bounds, true);
}
- MockAutofillManagerDelegate manager_delegate_;
+ MockAutofillClient autofill_client_;
scoped_ptr<MockAutofillDriver> autofill_driver_;
scoped_ptr<MockAutofillManager> autofill_manager_;
scoped_ptr<AutofillExternalDelegate> external_delegate_;
@@ -141,7 +137,7 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) {
// The enums must be cast to ints to prevent compile errors on linux_rel.
EXPECT_CALL(
- manager_delegate_,
+ autofill_client_,
ShowAutofillPopup(_,
_,
_,
@@ -167,7 +163,7 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) {
EXPECT_CALL(*autofill_manager_,
FillOrPreviewForm(
AutofillDriver::FORM_DATA_ACTION_FILL, _, _, _, _));
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
// This should trigger a call to hide the popup since we've selected an
// option.
@@ -186,7 +182,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) {
// The enums must be cast to ints to prevent compile errors on linux_rel.
EXPECT_CALL(
- manager_delegate_,
+ autofill_client_,
ShowAutofillPopup(_,
_,
_,
@@ -215,7 +211,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) {
// the datalist items are still shown.
// The enum must be cast to an int to prevent compile errors on linux_rel.
EXPECT_CALL(
- manager_delegate_,
+ autofill_client_,
ShowAutofillPopup(
_,
_,
@@ -238,8 +234,8 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) {
TEST_F(AutofillExternalDelegateUnitTest, UpdateDataListWhileShowingPopup) {
IssueOnQuery(kQueryId);
- EXPECT_CALL(manager_delegate_,
- ShowAutofillPopup(_, _, _, _, _, _, _)).Times(0);
+ EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _))
+ .Times(0);
// Make sure just setting the data list values doesn't cause the popup to
// appear.
@@ -251,7 +247,7 @@ TEST_F(AutofillExternalDelegateUnitTest, UpdateDataListWhileShowingPopup) {
// The enums must be cast to ints to prevent compile errors on linux_rel.
EXPECT_CALL(
- manager_delegate_,
+ autofill_client_,
ShowAutofillPopup(_,
_,
_,
@@ -284,9 +280,9 @@ TEST_F(AutofillExternalDelegateUnitTest, UpdateDataListWhileShowingPopup) {
data_list_items.push_back(base::string16());
// The enums must be cast to ints to prevent compile errors on linux_rel.
- EXPECT_CALL(manager_delegate_,
- UpdateAutofillPopupDataListValues(data_list_items,
- data_list_items));
+ EXPECT_CALL(
+ autofill_client_,
+ UpdateAutofillPopupDataListValues(data_list_items, data_list_items));
external_delegate_->SetCurrentDataListValues(data_list_items,
data_list_items);
@@ -300,7 +296,7 @@ TEST_F(AutofillExternalDelegateUnitTest, AutofillWarnings) {
// The enums must be cast to ints to prevent compile errors on linux_rel.
EXPECT_CALL(
- manager_delegate_,
+ autofill_client_,
ShowAutofillPopup(
_,
_,
@@ -334,9 +330,9 @@ TEST_F(AutofillExternalDelegateUnitTest, NoAutofillWarningsWithoutSuggestions) {
external_delegate_->OnQuery(kQueryId, form, field, element_bounds, true);
- EXPECT_CALL(manager_delegate_,
- ShowAutofillPopup(_, _, _, _, _, _, _)).Times(0);
- EXPECT_CALL(manager_delegate_, HideAutofillPopup()).Times(1);
+ EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(autofill_client_, HideAutofillPopup()).Times(1);
// This should not call ShowAutofillPopup.
std::vector<base::string16> autofill_item;
@@ -359,7 +355,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) {
external_delegate_->DidSelectSuggestion(base::string16(), -1);
// Ensure it doesn't try to fill the form in with the negative id.
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
EXPECT_CALL(*autofill_manager_, FillOrPreviewForm(_, _, _, _, _)).Times(0);
external_delegate_->DidAcceptSuggestion(base::string16(), -1);
}
@@ -390,17 +386,17 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateClearPreviewedForm) {
// Test that the popup is hidden once we are done editing the autofill field.
TEST_F(AutofillExternalDelegateUnitTest,
ExternalDelegateHidePopupAfterEditing) {
- EXPECT_CALL(manager_delegate_, ShowAutofillPopup(_, _, _, _, _, _, _));
+ EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _));
autofill::GenerateTestAutofillPopup(external_delegate_.get());
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
external_delegate_->DidEndTextFieldEditing();
}
// Test that the driver is directed to accept the data list after being notified
// that the user accepted the data list suggestion.
TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateAcceptSuggestion) {
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
base::string16 dummy_string(ASCIIToUTF16("baz qux"));
EXPECT_CALL(*autofill_driver_,
RendererShouldAcceptDataListSuggestion(dummy_string));
@@ -411,7 +407,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateAcceptSuggestion) {
// Test that the driver is directed to clear the form after being notified that
// the user accepted the suggestion to clear the form.
TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateClearForm) {
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
EXPECT_CALL(*autofill_driver_, RendererShouldClearFilledForm());
external_delegate_->DidAcceptSuggestion(base::string16(),
@@ -435,7 +431,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateHideWarning) {
// Ensure the popup tries to hide itself, since it is not allowed to show
// anything.
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
external_delegate_->OnSuggestionsReturned(kQueryId,
autofill_items,
@@ -445,7 +441,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateHideWarning) {
}
TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) {
- EXPECT_CALL(manager_delegate_, HideAutofillPopup());
+ EXPECT_CALL(autofill_client_, HideAutofillPopup());
base::string16 dummy_string(ASCIIToUTF16("baz foo"));
EXPECT_CALL(*autofill_driver_,
RendererShouldFillFieldWithValue(dummy_string));
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698