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

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

Issue 44543002: Enable touch for autofill popup view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Gtk and Cocoa compile errors Created 7 years, 2 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/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 04fea1105756122d8f231cbf9f1653c98fbb6828..7524b751dd62bf1c69dd8ef35fc38d2b0e79b95b 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
@@ -39,7 +39,7 @@ class MockAutofillExternalDelegate : public AutofillExternalDelegate {
autofill_driver) {}
virtual ~MockAutofillExternalDelegate() {}
- virtual void DidSelectSuggestion(int identifier) OVERRIDE {}
+ virtual void DidPreselectSuggestion(int identifier) OVERRIDE {}
virtual void RemoveSuggestion(const string16& value, int identifier) OVERRIDE
{}
virtual void ClearPreviewedForm() OVERRIDE {}
@@ -85,11 +85,11 @@ class TestAutofillPopupController : public AutofillPopupControllerImpl {
using AutofillPopupControllerImpl::names;
using AutofillPopupControllerImpl::subtexts;
using AutofillPopupControllerImpl::identifiers;
- using AutofillPopupControllerImpl::selected_line;
- using AutofillPopupControllerImpl::SetSelectedLine;
- using AutofillPopupControllerImpl::SelectNextLine;
- using AutofillPopupControllerImpl::SelectPreviousLine;
- using AutofillPopupControllerImpl::RemoveSelectedLine;
+ using AutofillPopupControllerImpl::preselected_line;
+ using AutofillPopupControllerImpl::SetPreselectedLine;
+ using AutofillPopupControllerImpl::PreselectNextLine;
+ using AutofillPopupControllerImpl::PreselectPreviousLine;
+ using AutofillPopupControllerImpl::RemovePreselectedLine;
using AutofillPopupControllerImpl::popup_bounds;
using AutofillPopupControllerImpl::element_bounds;
#if !defined(OS_ANDROID)
@@ -181,49 +181,49 @@ TEST_F(AutofillPopupControllerUnitTest, SetBounds) {
EXPECT_EQ(popup_bounds, popup_controller()->popup_bounds());
}
-TEST_F(AutofillPopupControllerUnitTest, ChangeSelectedLine) {
+TEST_F(AutofillPopupControllerUnitTest, ChangePreselectedLine) {
// Set up the popup.
std::vector<string16> names(2, string16());
std::vector<int> autofill_ids(2, 0);
autofill_popup_controller_->Show(names, names, names, autofill_ids);
- EXPECT_LT(autofill_popup_controller_->selected_line(), 0);
+ EXPECT_LT(autofill_popup_controller_->preselected_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_->subtexts().size()));
// Test wrapping before the front.
- autofill_popup_controller_->SelectPreviousLine();
+ autofill_popup_controller_->PreselectPreviousLine();
EXPECT_EQ(static_cast<int>(
autofill_popup_controller_->subtexts().size() - 1),
- autofill_popup_controller_->selected_line());
+ autofill_popup_controller_->preselected_line());
// Test wrapping after the end.
- autofill_popup_controller_->SelectNextLine();
- EXPECT_EQ(0, autofill_popup_controller_->selected_line());
+ autofill_popup_controller_->PreselectNextLine();
+ EXPECT_EQ(0, autofill_popup_controller_->preselected_line());
}
-TEST_F(AutofillPopupControllerUnitTest, RedrawSelectedLine) {
+TEST_F(AutofillPopupControllerUnitTest, RedrawPreselectedLine) {
// Set up the popup.
std::vector<string16> names(2, string16());
std::vector<int> autofill_ids(2, 0);
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.
- int selected_line = 0;
- EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(selected_line));
- autofill_popup_controller_->SetSelectedLine(selected_line);
+ // Make sure that when a new line is preselected, it is invalidated so it can
+ // be updated to show it is preselected.
+ int preselected_line = 0;
+ EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(preselected_line));
+ autofill_popup_controller_->SetPreselectedLine(preselected_line);
// Ensure that the row isn't invalidated if it didn't change.
EXPECT_CALL(*autofill_popup_controller_,
- InvalidateRow(selected_line)).Times(0);
- autofill_popup_controller_->SetSelectedLine(selected_line);
+ InvalidateRow(preselected_line)).Times(0);
+ autofill_popup_controller_->SetPreselectedLine(preselected_line);
- // Change back to no selection.
- EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(selected_line));
- autofill_popup_controller_->SetSelectedLine(-1);
+ // Change back to no preselection.
+ EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(preselected_line));
+ autofill_popup_controller_->SetPreselectedLine(-1);
}
TEST_F(AutofillPopupControllerUnitTest, RemoveLine) {
@@ -240,26 +240,26 @@ TEST_F(AutofillPopupControllerUnitTest, RemoveLine) {
// testing the popup here.
autofill::GenerateTestAutofillPopup(external_delegate_.get());
- // No line is selected so the removal should fail.
- EXPECT_FALSE(autofill_popup_controller_->RemoveSelectedLine());
+ // No line is preselected so the removal should fail.
+ EXPECT_FALSE(autofill_popup_controller_->RemovePreselectedLine());
// Try to remove the last entry and ensure it fails (it is an option).
- autofill_popup_controller_->SetSelectedLine(
+ autofill_popup_controller_->SetPreselectedLine(
autofill_popup_controller_->subtexts().size() - 1);
- EXPECT_FALSE(autofill_popup_controller_->RemoveSelectedLine());
- EXPECT_LE(0, autofill_popup_controller_->selected_line());
+ EXPECT_FALSE(autofill_popup_controller_->RemovePreselectedLine());
+ EXPECT_LE(0, autofill_popup_controller_->preselected_line());
// Remove the first entry. The popup should be redrawn since its size has
// changed.
EXPECT_CALL(*autofill_popup_controller_, UpdateBoundsAndRedrawPopup());
- autofill_popup_controller_->SetSelectedLine(0);
- EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine());
+ autofill_popup_controller_->SetPreselectedLine(0);
+ EXPECT_TRUE(autofill_popup_controller_->RemovePreselectedLine());
// Remove the last entry. The popup should then be hidden since there are
// no Autofill entries left.
EXPECT_CALL(*autofill_popup_controller_, Hide());
- autofill_popup_controller_->SetSelectedLine(0);
- EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine());
+ autofill_popup_controller_->SetPreselectedLine(0);
+ EXPECT_TRUE(autofill_popup_controller_->RemovePreselectedLine());
}
TEST_F(AutofillPopupControllerUnitTest, RemoveOnlyLine) {
@@ -272,14 +272,14 @@ TEST_F(AutofillPopupControllerUnitTest, RemoveOnlyLine) {
// Generate a popup.
autofill::GenerateTestAutofillPopup(external_delegate_.get());
- // Select the only line.
- autofill_popup_controller_->SetSelectedLine(0);
+ // Preselect the only line.
+ autofill_popup_controller_->SetPreselectedLine(0);
// Remove the only line. There should be no row invalidation and the popup
// should then be hidden since there are no Autofill entries left.
EXPECT_CALL(*autofill_popup_controller_, Hide());
EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(_)).Times(0);
- EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine());
+ EXPECT_TRUE(autofill_popup_controller_->RemovePreselectedLine());
}
TEST_F(AutofillPopupControllerUnitTest, SkipSeparator) {
@@ -291,15 +291,15 @@ TEST_F(AutofillPopupControllerUnitTest, SkipSeparator) {
autofill_ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
autofill_popup_controller_->Show(names, names, names, autofill_ids);
- autofill_popup_controller_->SetSelectedLine(0);
+ autofill_popup_controller_->SetPreselectedLine(0);
// Make sure next skips the unselectable separator.
- autofill_popup_controller_->SelectNextLine();
- EXPECT_EQ(2, autofill_popup_controller_->selected_line());
+ autofill_popup_controller_->PreselectNextLine();
+ EXPECT_EQ(2, autofill_popup_controller_->preselected_line());
// Make sure previous skips the unselectable separator.
- autofill_popup_controller_->SelectPreviousLine();
- EXPECT_EQ(0, autofill_popup_controller_->selected_line());
+ autofill_popup_controller_->PreselectPreviousLine();
+ EXPECT_EQ(0, autofill_popup_controller_->preselected_line());
}
TEST_F(AutofillPopupControllerUnitTest, RowWidthWithoutText) {
@@ -476,7 +476,7 @@ TEST_F(AutofillPopupControllerUnitTest, ProperlyResetController) {
std::vector<string16> names(2);
std::vector<int> ids(2);
popup_controller()->SetValues(names, names, names, ids);
- popup_controller()->SetSelectedLine(0);
+ popup_controller()->SetPreselectedLine(0);
// Now show a new popup with the same controller, but with fewer items.
WeakPtr<AutofillPopupControllerImpl> controller =
@@ -486,7 +486,7 @@ TEST_F(AutofillPopupControllerUnitTest, ProperlyResetController) {
NULL,
gfx::Rect(),
base::i18n::UNKNOWN_DIRECTION);
- EXPECT_NE(0, controller->selected_line());
+ EXPECT_NE(0, controller->preselected_line());
EXPECT_TRUE(controller->names().empty());
}

Powered by Google App Engine
This is Rietveld 408576698