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 a6ef0406f1470abf07411f11d52bf338f4b68616..baaf1427797ed6c2f65b26d123fa467a95beb3a9 100644 |
--- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc |
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc |
@@ -26,6 +26,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "ui/accessibility/ax_enums.h" |
#include "ui/gfx/geometry/rect.h" |
#include "ui/gfx/text_utils.h" |
@@ -96,6 +97,7 @@ class TestAutofillPopupController : public AutofillPopupControllerImpl { |
using AutofillPopupControllerImpl::SetValues; |
using AutofillPopupControllerImpl::GetWeakPtr; |
MOCK_METHOD1(InvalidateRow, void(size_t)); |
+ MOCK_METHOD2(NotifyAccessibilityEventForRow, void(ui::AXEvent, size_t)); |
MOCK_METHOD0(UpdateBoundsAndRedrawPopup, void()); |
MOCK_METHOD0(Hide, void()); |
@@ -133,9 +135,8 @@ class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { |
driver->autofill_manager(), |
driver)); |
- autofill_popup_controller_ = |
- new testing::NiceMock<TestAutofillPopupController>( |
- external_delegate_->GetWeakPtr(), gfx::RectF()); |
+ autofill_popup_controller_ = new NiceMock<TestAutofillPopupController>( |
+ external_delegate_->GetWeakPtr(), gfx::RectF()); |
} |
void TearDown() override { |
@@ -159,7 +160,7 @@ class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { |
protected: |
std::unique_ptr<MockAutofillClient> autofill_client_; |
std::unique_ptr<NiceMock<MockAutofillExternalDelegate>> external_delegate_; |
- testing::NiceMock<TestAutofillPopupController>* autofill_popup_controller_; |
+ NiceMock<TestAutofillPopupController>* autofill_popup_controller_; |
}; |
TEST_F(AutofillPopupControllerUnitTest, ChangeSelectedLine) { |
@@ -197,15 +198,22 @@ TEST_F(AutofillPopupControllerUnitTest, RedrawSelectedLine) { |
// be updated to show it is selected. |
int selected_line = 0; |
EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(selected_line)); |
+ EXPECT_CALL( |
+ *autofill_popup_controller_, |
+ NotifyAccessibilityEventForRow(ui::AX_EVENT_SELECTION, selected_line)); |
autofill_popup_controller_->SetSelectedLine(selected_line); |
// Ensure that the row isn't invalidated if it didn't change. |
EXPECT_CALL(*autofill_popup_controller_, |
InvalidateRow(selected_line)).Times(0); |
+ EXPECT_CALL(*autofill_popup_controller_, NotifyAccessibilityEventForRow(_, _)) |
+ .Times(0); |
autofill_popup_controller_->SetSelectedLine(selected_line); |
// Change back to no selection. |
EXPECT_CALL(*autofill_popup_controller_, InvalidateRow(selected_line)); |
+ EXPECT_CALL(*autofill_popup_controller_, NotifyAccessibilityEventForRow(_, _)) |
+ .Times(0); |
autofill_popup_controller_->SetSelectedLine(-1); |
} |
@@ -254,6 +262,8 @@ TEST_F(AutofillPopupControllerUnitTest, RemoveOnlyLine) { |
// 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_CALL(*autofill_popup_controller_, NotifyAccessibilityEventForRow(_, _)) |
+ .Times(0); |
EXPECT_TRUE(autofill_popup_controller_->RemoveSelectedLine()); |
} |
@@ -386,9 +396,9 @@ TEST_F(AutofillPopupControllerUnitTest, GetOrCreate) { |
EXPECT_EQ(controller.get(), controller2.get()); |
controller->Hide(); |
- testing::NiceMock<TestAutofillPopupController>* test_controller = |
- new testing::NiceMock<TestAutofillPopupController>(delegate.GetWeakPtr(), |
- gfx::RectF()); |
+ NiceMock<TestAutofillPopupController>* test_controller = |
+ new NiceMock<TestAutofillPopupController>(delegate.GetWeakPtr(), |
+ gfx::RectF()); |
EXPECT_CALL(*test_controller, Hide()); |
gfx::RectF bounds(0.f, 0.f, 1.f, 2.f); |