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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc

Issue 11636040: AutofillPopupController clarifications + simplifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new workstation Created 8 years 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: chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
index 0be3e3b743ee4e5e1639b7b7a0f41c60123124c8..37975e8b1e7733a584b0f8c92053f803fb0b03a1 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
@@ -22,10 +22,9 @@ class MockAutofillExternalDelegate :
MockAutofillExternalDelegate() : TestAutofillExternalDelegate(NULL, NULL) {};
virtual ~MockAutofillExternalDelegate() {};
- virtual void SelectAutofillSuggestion(int unique_id)
- OVERRIDE {}
- virtual void RemoveAutocompleteEntry(const string16& value) OVERRIDE {}
- virtual void RemoveAutofillProfileOrCreditCard(int unique_id) OVERRIDE {}
+ virtual void DidSelectSuggestion(int identifier) OVERRIDE {}
+ virtual void RemoveSuggestion(const string16& value, int identifier) OVERRIDE
+ {}
virtual void ClearPreviewedForm() OVERRIDE {}
MOCK_METHOD0(ControllerDestroyed, void());
@@ -39,8 +38,8 @@ class TestAutofillPopupController : public AutofillPopupControllerImpl {
virtual ~TestAutofillPopupController() {}
// Making protected functions public for testing
- const std::vector<string16>& autofill_values() const {
- return AutofillPopupControllerImpl::autofill_values();
+ const std::vector<string16>& subtexts() const {
+ return AutofillPopupControllerImpl::subtexts();
}
int selected_line() const {
return AutofillPopupControllerImpl::selected_line();
@@ -107,21 +106,20 @@ TEST_F(AutofillPopupControllerUnitTest, SetBounds) {
TEST_F(AutofillPopupControllerUnitTest, ChangeSelectedLine) {
// Set up the popup.
- std::vector<string16> autofill_values(2, string16());
+ std::vector<string16> names(2, string16());
std::vector<int> autofill_ids(2, 0);
- autofill_popup_controller_->Show(
- autofill_values, autofill_values, autofill_values, autofill_ids);
+ autofill_popup_controller_->Show(names, names, names, autofill_ids);
EXPECT_LT(autofill_popup_controller_->selected_line(), 0);
// Check that there are at least 2 values so that the first and last selection
// are different.
EXPECT_GE(2,
- static_cast<int>(autofill_popup_controller_->autofill_values().size()));
+ static_cast<int>(autofill_popup_controller_->subtexts().size()));
// Test wrapping before the front.
autofill_popup_controller_->SelectPreviousLine();
EXPECT_EQ(static_cast<int>(
- autofill_popup_controller_->autofill_values().size() - 1),
+ autofill_popup_controller_->subtexts().size() - 1),
autofill_popup_controller_->selected_line());
// Test wrapping after the end.
@@ -131,11 +129,9 @@ TEST_F(AutofillPopupControllerUnitTest, ChangeSelectedLine) {
TEST_F(AutofillPopupControllerUnitTest, RedrawSelectedLine) {
// Set up the popup.
- std::vector<string16> autofill_values(2, string16());
+ std::vector<string16> names(2, string16());
std::vector<int> autofill_ids(2, 0);
- autofill_popup_controller_->Show(
- autofill_values, autofill_values, autofill_values,
- autofill_ids);
+ autofill_popup_controller_->Show(names, names, names, autofill_ids);
// Make sure that when a new line is selected, it is invalidated so it can
// be updated to show it is selected.
@@ -155,13 +151,12 @@ TEST_F(AutofillPopupControllerUnitTest, RedrawSelectedLine) {
TEST_F(AutofillPopupControllerUnitTest, RemoveLine) {
// Set up the popup.
- std::vector<string16> autofill_values(3, string16());
+ std::vector<string16> names(3, string16());
std::vector<int> autofill_ids;
autofill_ids.push_back(1);
autofill_ids.push_back(1);
autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
- autofill_popup_controller_->Show(
- autofill_values, autofill_values, autofill_values, autofill_ids);
+ autofill_popup_controller_->Show(names, names, names, autofill_ids);
// Generate a popup, so it can be hidden later. It doesn't matter what the
// external_delegate thinks is being shown in the process, since we are just
@@ -173,7 +168,7 @@ TEST_F(AutofillPopupControllerUnitTest, RemoveLine) {
// Try to remove the last entry and ensure it fails (it is an option).
autofill_popup_controller_->SetSelectedLine(
- autofill_popup_controller_->autofill_values().size() - 1);
+ autofill_popup_controller_->subtexts().size() - 1);
EXPECT_FALSE(autofill_popup_controller_->RemoveSelectedLine());
EXPECT_LE(0, autofill_popup_controller_->selected_line());
@@ -195,13 +190,12 @@ TEST_F(AutofillPopupControllerUnitTest, RemoveLine) {
TEST_F(AutofillPopupControllerUnitTest, SkipSeparator) {
// Set up the popup.
- std::vector<string16> autofill_values(3, string16());
+ std::vector<string16> names(3, string16());
std::vector<int> autofill_ids;
autofill_ids.push_back(1);
autofill_ids.push_back(WebAutofillClient::MenuItemIDSeparator);
autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
- autofill_popup_controller_->Show(
- autofill_values, autofill_values, autofill_values, autofill_ids);
+ autofill_popup_controller_->Show(names, names, names, autofill_ids);
autofill_popup_controller_->SetSelectedLine(0);
« no previous file with comments | « chrome/browser/ui/autofill/autofill_popup_controller_impl.cc ('k') | chrome/browser/ui/autofill/autofill_popup_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698