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

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: ilya review 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 efc5e4d2edf5ed3a0f50a59326afbfdaa9aca160..33e38cbf865772f2816588c12607adcc2399f6c7 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 SelectAutofillSuggestionAtIndex(int unique_id)
- OVERRIDE {}
+ virtual void DidSelectSuggestion(int identifier) OVERRIDE {}
+ virtual void RemoveSuggestion(int identifier) OVERRIDE {}
virtual void RemoveAutocompleteEntry(const string16& value) OVERRIDE {}
- virtual void RemoveAutofillProfileOrCreditCard(int unique_id) 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>& labels() const {
+ return AutofillPopupControllerImpl::labels();
}
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> labels(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(labels, labels, labels, 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_->labels().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_->labels().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> labels(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(labels, labels, labels, 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> labels(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(labels, labels, labels, 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_->labels().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> labels(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(labels, labels, labels, autofill_ids);
autofill_popup_controller_->SetSelectedLine(0);

Powered by Google App Engine
This is Rietveld 408576698