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

Unified Diff: chrome/browser/autofill/autofill_popup_unittest.cc

Issue 10408070: Upgrade Seperator in New Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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: chrome/browser/autofill/autofill_popup_unittest.cc
diff --git a/chrome/browser/autofill/autofill_popup_unittest.cc b/chrome/browser/autofill/autofill_popup_unittest.cc
index 5c3d731a36b82e951ef316310487a48e5c2f1392..d2dfa07b3aeac8b1a93474599d40077349181fbd 100644
--- a/chrome/browser/autofill/autofill_popup_unittest.cc
+++ b/chrome/browser/autofill/autofill_popup_unittest.cc
@@ -37,6 +37,9 @@ class TestAutofillPopupView : public AutofillPopupView {
const std::vector<string16>& autofill_values() const {
return AutofillPopupView::autofill_values();
}
+ int row_count() {
+ return AutofillPopupView::row_count();
+ }
int selected_line() const {
return AutofillPopupView::selected_line();
}
@@ -52,8 +55,8 @@ class TestAutofillPopupView : public AutofillPopupView {
bool RemoveSelectedLine() {
return AutofillPopupView::RemoveSelectedLine();
}
- bool IsSeparatorIndex(int index) {
- return AutofillPopupView::IsSeparatorIndex(index);
+ int RowToIndex(size_t row) {
+ return AutofillPopupView::RowToIndex(row);
}
MOCK_METHOD1(InvalidateRow, void(size_t));
@@ -94,12 +97,12 @@ TEST_F(AutofillPopupViewUnitTest, ChangeSelectedLine) {
// 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_view_->autofill_values().size()));
+ static_cast<int>(autofill_popup_view_->row_count()));
// Test wrapping before the front.
autofill_popup_view_->SelectPreviousLine();
EXPECT_EQ(
- static_cast<int>(autofill_popup_view_->autofill_values().size() - 1),
+ static_cast<int>(autofill_popup_view_->row_count() - 1),
autofill_popup_view_->selected_line());
// Test wrapping after the end.
@@ -157,18 +160,25 @@ TEST_F(AutofillPopupViewUnitTest, RemoveLine) {
EXPECT_TRUE(autofill_popup_view_->RemoveSelectedLine());
}
-TEST_F(AutofillPopupViewUnitTest, IsSeparatorIndex) {
- // Set up the popup.
- std::vector<string16> autofill_values(3, string16());
+TEST_F(AutofillPopupViewUnitTest, IndexToRowMappings) {
+ // Set up the popup.
+ std::vector<string16> autofill_values(6, string16());
std::vector<int> autofill_ids;
+ autofill_ids.push_back(0);
+ autofill_ids.push_back(WebAutofillClient::MenuItemIDSeparator);
autofill_ids.push_back(3);
+ autofill_ids.push_back(WebAutofillClient::MenuItemIDSeparator);
autofill_ids.push_back(WebAutofillClient::MenuItemIDClearForm);
autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
autofill_popup_view_->Show(autofill_values, autofill_values, autofill_values,
autofill_ids);
- EXPECT_FALSE(autofill_popup_view_->IsSeparatorIndex(0));
- EXPECT_TRUE(autofill_popup_view_->IsSeparatorIndex(1));
- EXPECT_FALSE(autofill_popup_view_->IsSeparatorIndex(2));
+ EXPECT_EQ(4, autofill_popup_view_->row_count());
+
+ EXPECT_EQ(0, autofill_popup_view_->RowToIndex(0));
+ EXPECT_EQ(2, autofill_popup_view_->RowToIndex(1));
+ EXPECT_EQ(4, autofill_popup_view_->RowToIndex(2));
+ EXPECT_EQ(5, autofill_popup_view_->RowToIndex(3));
+ EXPECT_EQ(-1, autofill_popup_view_->RowToIndex(4));
}

Powered by Google App Engine
This is Rietveld 408576698