Commit 3774d66c authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

cros: Rename LoginTestBase::data_dispatcher to DataDispatcher

This puts the method name more in line with Google C++ style, since snake_case
should only be used with simple getters.

Bug: 906676
Change-Id: I045aa7c8ac641b37854b38cf0934890ebbd88ca0
Reviewed-on: https://chromium-review.googlesource.com/c/1343250Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609491}
parent 73b9579d
...@@ -78,8 +78,8 @@ TEST_F(LockContentsViewUnitTest, DisplayMode) { ...@@ -78,8 +78,8 @@ TEST_F(LockContentsViewUnitTest, DisplayMode) {
// Build lock screen with 1 user. // Build lock screen with 1 user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -125,8 +125,8 @@ TEST_F(LockContentsViewUnitTest, DisplayMode) { ...@@ -125,8 +125,8 @@ TEST_F(LockContentsViewUnitTest, DisplayMode) {
TEST_F(LockContentsViewUnitTest, SingleUserCentered) { TEST_F(LockContentsViewUnitTest, SingleUserCentered) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -148,8 +148,8 @@ TEST_F(LockContentsViewUnitTest, SingleUserCentered) { ...@@ -148,8 +148,8 @@ TEST_F(LockContentsViewUnitTest, SingleUserCentered) {
TEST_F(LockContentsViewUnitTest, SingleUserCenteredNoteActionEnabled) { TEST_F(LockContentsViewUnitTest, SingleUserCenteredNoteActionEnabled) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -172,8 +172,8 @@ TEST_F(LockContentsViewUnitTest, LayoutInSmallScreenSize) { ...@@ -172,8 +172,8 @@ TEST_F(LockContentsViewUnitTest, LayoutInSmallScreenSize) {
// Build lock screen. // Build lock screen.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi lock_contents(contents); LockContentsView::TestApi lock_contents(contents);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
display::test::DisplayManagerTestApi display_manager_test_api( display::test::DisplayManagerTestApi display_manager_test_api(
...@@ -232,8 +232,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutAfterRotation) { ...@@ -232,8 +232,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutAfterRotation) {
// Build lock screen with three users. // Build lock screen with three users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi lock_contents(contents); LockContentsView::TestApi lock_contents(contents);
SetUserCount(3); SetUserCount(3);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -283,8 +283,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutExtraSmallUsersListAfterRotation) { ...@@ -283,8 +283,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutExtraSmallUsersListAfterRotation) {
// Build lock screen with extra small layout (> 6 users). // Build lock screen with extra small layout (> 6 users).
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(9); SetUserCount(9);
ScrollableUsersListView* users_list = ScrollableUsersListView* users_list =
LockContentsView::TestApi(contents).users_list(); LockContentsView::TestApi(contents).users_list();
...@@ -320,8 +320,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutSmallUsersListAfterRotation) { ...@@ -320,8 +320,8 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutSmallUsersListAfterRotation) {
// Build lock screen with small layout (3-6 users). // Build lock screen with small layout (3-6 users).
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(4); SetUserCount(4);
ScrollableUsersListView* users_list = ScrollableUsersListView* users_list =
LockContentsView::TestApi(contents).users_list(); LockContentsView::TestApi(contents).users_list();
...@@ -435,8 +435,8 @@ TEST_F(LockContentsViewUnitTest, SwapAuthUsersInTwoUserLayout) { ...@@ -435,8 +435,8 @@ TEST_F(LockContentsViewUnitTest, SwapAuthUsersInTwoUserLayout) {
// Build lock screen with two users. // Build lock screen with two users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi test_api(contents); LockContentsView::TestApi test_api(contents);
SetUserCount(2); SetUserCount(2);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -481,8 +481,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) { ...@@ -481,8 +481,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) {
// Build lock screen with five users. // Build lock screen with five users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi lock_contents(contents); LockContentsView::TestApi lock_contents(contents);
SetUserCount(5); SetUserCount(5);
ScrollableUsersListView::TestApi users_list(lock_contents.users_list()); ScrollableUsersListView::TestApi users_list(lock_contents.users_list());
...@@ -525,8 +525,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) { ...@@ -525,8 +525,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) {
TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) { TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -537,20 +537,20 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) { ...@@ -537,20 +537,20 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) {
EXPECT_TRUE(note_action_button->visible()); EXPECT_TRUE(note_action_button->visible());
// In kLaunching state, the note action button should not be visible. // In kLaunching state, the note action button should not be visible.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kLaunching); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kLaunching);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
// In kActive state, the note action button should not be visible. // In kActive state, the note action button should not be visible.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
// When moved back to kAvailable state, the note action button should become // When moved back to kAvailable state, the note action button should become
// visible again. // visible again.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable);
EXPECT_TRUE(note_action_button->visible()); EXPECT_TRUE(note_action_button->visible());
// In kNotAvailable state, the note action button should not be visible. // In kNotAvailable state, the note action button should not be visible.
data_dispatcher()->SetLockScreenNoteState( DataDispatcher()->SetLockScreenNoteState(
mojom::TrayActionState::kNotAvailable); mojom::TrayActionState::kNotAvailable);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
} }
...@@ -559,8 +559,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) { ...@@ -559,8 +559,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonVisibilityChanges) {
TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) { TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -572,7 +572,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) { ...@@ -572,7 +572,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) {
// When the note action becomes available, the note action button should be // When the note action becomes available, the note action button should be
// shown. // shown.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable);
EXPECT_TRUE(test_api.note_action()->visible()); EXPECT_TRUE(test_api.note_action()->visible());
// Verify the bounds of the note action button are as expected. // Verify the bounds of the note action button are as expected.
...@@ -585,7 +585,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) { ...@@ -585,7 +585,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) {
// If the note action is disabled again, the note action button should be // If the note action is disabled again, the note action button should be
// hidden. // hidden.
data_dispatcher()->SetLockScreenNoteState( DataDispatcher()->SetLockScreenNoteState(
mojom::TrayActionState::kNotAvailable); mojom::TrayActionState::kNotAvailable);
EXPECT_FALSE(test_api.note_action()->visible()); EXPECT_FALSE(test_api.note_action()->visible());
} }
...@@ -595,8 +595,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) { ...@@ -595,8 +595,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBounds) {
TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) { TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -613,7 +613,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) { ...@@ -613,7 +613,7 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) {
test_api.note_action()->GetBoundsInScreen()); test_api.note_action()->GetBoundsInScreen());
// If the note action is disabled, the note action button should be hidden. // If the note action is disabled, the note action button should be hidden.
data_dispatcher()->SetLockScreenNoteState( DataDispatcher()->SetLockScreenNoteState(
mojom::TrayActionState::kNotAvailable); mojom::TrayActionState::kNotAvailable);
EXPECT_FALSE(test_api.note_action()->visible()); EXPECT_FALSE(test_api.note_action()->visible());
} }
...@@ -622,8 +622,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) { ...@@ -622,8 +622,8 @@ TEST_F(LockContentsViewUnitTest, NoteActionButtonBoundsInitiallyAvailable) {
TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) { TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -634,8 +634,8 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) { ...@@ -634,8 +634,8 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
// Verify that the system info view becomes visible and it doesn't block the // Verify that the system info view becomes visible and it doesn't block the
// note action button. // note action button.
data_dispatcher()->SetSystemInfo(true /*show_if_hidden*/, "Best version ever", DataDispatcher()->SetSystemInfo(true /*show_if_hidden*/, "Best version ever",
"Asset ID: 6666", "Bluetooth adapter"); "Asset ID: 6666", "Bluetooth adapter");
EXPECT_TRUE(test_api.system_info()->visible()); EXPECT_TRUE(test_api.system_info()->visible());
EXPECT_TRUE(test_api.note_action()->visible()); EXPECT_TRUE(test_api.note_action()->visible());
gfx::Size note_action_size = test_api.note_action()->GetPreferredSize(); gfx::Size note_action_size = test_api.note_action()->GetPreferredSize();
...@@ -645,7 +645,7 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) { ...@@ -645,7 +645,7 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
// Verify that if the note action is disabled, the system info view moves to // Verify that if the note action is disabled, the system info view moves to
// the right to fill the empty space. // the right to fill the empty space.
data_dispatcher()->SetLockScreenNoteState( DataDispatcher()->SetLockScreenNoteState(
mojom::TrayActionState::kNotAvailable); mojom::TrayActionState::kNotAvailable);
EXPECT_FALSE(test_api.note_action()->visible()); EXPECT_FALSE(test_api.note_action()->visible());
EXPECT_LT(widget_bounds.right() - EXPECT_LT(widget_bounds.right() -
...@@ -657,8 +657,8 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) { ...@@ -657,8 +657,8 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) { TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -668,9 +668,8 @@ TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) { ...@@ -668,9 +668,8 @@ TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) {
// Verify that the system info view does not become visible when given data // Verify that the system info view does not become visible when given data
// but show is false. // but show is false.
data_dispatcher()->SetSystemInfo(false /*show_if_hidden*/, DataDispatcher()->SetSystemInfo(false /*show_if_hidden*/, "Best version ever",
"Best version ever", "Asset ID: 6666", "Asset ID: 6666", "Bluetooth adapter");
"Bluetooth adapter");
EXPECT_FALSE(test_api.system_info()->visible()); EXPECT_FALSE(test_api.system_info()->visible());
// Alt-V shows hidden system info. // Alt-V shows hidden system info.
...@@ -689,16 +688,16 @@ TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) { ...@@ -689,16 +688,16 @@ TEST_F(LockContentsViewUnitTest, AltVShowsHiddenSystemInfo) {
TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) { TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
LockContentsView::TestApi test_api(contents); LockContentsView::TestApi test_api(contents);
auto set_system_info = [&](bool show_if_hidden) { auto set_system_info = [&](bool show_if_hidden) {
data_dispatcher()->SetSystemInfo(show_if_hidden, "Best version ever", DataDispatcher()->SetSystemInfo(show_if_hidden, "Best version ever",
"Asset ID: 6666", "Bluetooth adapter"); "Asset ID: 6666", "Bluetooth adapter");
}; };
// Start with hidden system info. // Start with hidden system info.
...@@ -718,8 +717,8 @@ TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) { ...@@ -718,8 +717,8 @@ TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) {
TEST_F(LockContentsViewUnitTest, EasyUnlockForceTooltipCreatesTooltipWidget) { TEST_F(LockContentsViewUnitTest, EasyUnlockForceTooltipCreatesTooltipWidget) {
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
...@@ -733,14 +732,14 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockForceTooltipCreatesTooltipWidget) { ...@@ -733,14 +732,14 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockForceTooltipCreatesTooltipWidget) {
auto icon = mojom::EasyUnlockIconOptions::New(); auto icon = mojom::EasyUnlockIconOptions::New();
icon->icon = mojom::EasyUnlockIconId::LOCKED; icon->icon = mojom::EasyUnlockIconId::LOCKED;
icon->autoshow_tooltip = false; icon->autoshow_tooltip = false;
data_dispatcher()->ShowEasyUnlockIcon(users()[0]->basic_user_info->account_id, DataDispatcher()->ShowEasyUnlockIcon(users()[0]->basic_user_info->account_id,
icon); icon);
EXPECT_FALSE(test_api.tooltip_bubble()->IsVisible()); EXPECT_FALSE(test_api.tooltip_bubble()->IsVisible());
// Show icon with |autoshow_tooltip| set to true. Tooltip bubble is shown. // Show icon with |autoshow_tooltip| set to true. Tooltip bubble is shown.
icon->autoshow_tooltip = true; icon->autoshow_tooltip = true;
data_dispatcher()->ShowEasyUnlockIcon(users()[0]->basic_user_info->account_id, DataDispatcher()->ShowEasyUnlockIcon(users()[0]->basic_user_info->account_id,
icon); icon);
EXPECT_TRUE(test_api.tooltip_bubble()->IsVisible()); EXPECT_TRUE(test_api.tooltip_bubble()->IsVisible());
} }
...@@ -749,8 +748,8 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) { ...@@ -749,8 +748,8 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) {
// Build lock screen with two users. // Build lock screen with two users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(2); SetUserCount(2);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -774,7 +773,7 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) { ...@@ -774,7 +773,7 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) {
auto enable_icon = [&](LoginBigUserView* view) { auto enable_icon = [&](LoginBigUserView* view) {
auto icon = mojom::EasyUnlockIconOptions::New(); auto icon = mojom::EasyUnlockIconOptions::New();
icon->icon = mojom::EasyUnlockIconId::LOCKED; icon->icon = mojom::EasyUnlockIconId::LOCKED;
data_dispatcher()->ShowEasyUnlockIcon( DataDispatcher()->ShowEasyUnlockIcon(
view->GetCurrentUser()->basic_user_info->account_id, icon); view->GetCurrentUser()->basic_user_info->account_id, icon);
}; };
...@@ -782,7 +781,7 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) { ...@@ -782,7 +781,7 @@ TEST_F(LockContentsViewUnitTest, EasyUnlockIconUpdatedDuringUserSwap) {
auto disable_icon = [&](LoginBigUserView* view) { auto disable_icon = [&](LoginBigUserView* view) {
auto icon = mojom::EasyUnlockIconOptions::New(); auto icon = mojom::EasyUnlockIconOptions::New();
icon->icon = mojom::EasyUnlockIconId::NONE; icon->icon = mojom::EasyUnlockIconId::NONE;
data_dispatcher()->ShowEasyUnlockIcon( DataDispatcher()->ShowEasyUnlockIcon(
view->GetCurrentUser()->basic_user_info->account_id, icon); view->GetCurrentUser()->basic_user_info->account_id, icon);
}; };
...@@ -840,8 +839,8 @@ TEST_F(LockContentsViewUnitTest, ShowErrorBubbleOnAuthFailure) { ...@@ -840,8 +839,8 @@ TEST_F(LockContentsViewUnitTest, ShowErrorBubbleOnAuthFailure) {
// Build lock screen with a single user. // Build lock screen with a single user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -873,8 +872,8 @@ TEST_F(LockContentsViewUnitTest, GaiaNeverShownOnLockAfterFailedAuth) { ...@@ -873,8 +872,8 @@ TEST_F(LockContentsViewUnitTest, GaiaNeverShownOnLockAfterFailedAuth) {
// Build lock screen with a single user. // Build lock screen with a single user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -899,8 +898,8 @@ TEST_F(LockContentsViewUnitTest, ShowGaiaAuthAfterManyFailedLoginAttempts) { ...@@ -899,8 +898,8 @@ TEST_F(LockContentsViewUnitTest, ShowGaiaAuthAfterManyFailedLoginAttempts) {
// Build lock screen with a single user. // Build lock screen with a single user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -932,14 +931,14 @@ TEST_F(LockContentsViewUnitTest, ShowGaiaAuthAfterManyFailedLoginAttempts) { ...@@ -932,14 +931,14 @@ TEST_F(LockContentsViewUnitTest, ShowGaiaAuthAfterManyFailedLoginAttempts) {
TEST_F(LockContentsViewUnitTest, ErrorBubbleOnUntrustedDetachableBase) { TEST_F(LockContentsViewUnitTest, ErrorBubbleOnUntrustedDetachableBase) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
// Build lock screen with 2 users. // Build lock screen with 2 users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(2); SetUserCount(2);
const AccountId& kFirstUserAccountId = const AccountId& kFirstUserAccountId =
...@@ -1014,14 +1013,14 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleOnUntrustedDetachableBase) { ...@@ -1014,14 +1013,14 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleOnUntrustedDetachableBase) {
TEST_F(LockContentsViewUnitTest, ErrorBubbleForUnauthenticatedDetachableBase) { TEST_F(LockContentsViewUnitTest, ErrorBubbleForUnauthenticatedDetachableBase) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
// Build lock screen with 2 users. // Build lock screen with 2 users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(2); SetUserCount(2);
const AccountId& kFirstUserAccountId = const AccountId& kFirstUserAccountId =
...@@ -1077,14 +1076,14 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleForUnauthenticatedDetachableBase) { ...@@ -1077,14 +1076,14 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleForUnauthenticatedDetachableBase) {
TEST_F(LockContentsViewUnitTest, TEST_F(LockContentsViewUnitTest,
RemovingAttachedBaseHidesDetachableBaseNotification) { RemovingAttachedBaseHidesDetachableBaseNotification) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
// Build lock screen with 2 users. // Build lock screen with 2 users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(1); SetUserCount(1);
const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id; const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id;
...@@ -1113,14 +1112,14 @@ TEST_F(LockContentsViewUnitTest, ...@@ -1113,14 +1112,14 @@ TEST_F(LockContentsViewUnitTest,
TEST_F(LockContentsViewUnitTest, DetachableBaseErrorClearsAuthError) { TEST_F(LockContentsViewUnitTest, DetachableBaseErrorClearsAuthError) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
// Build lock screen with a single user. // Build lock screen with a single user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(1); SetUserCount(1);
const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id; const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id;
...@@ -1164,14 +1163,14 @@ TEST_F(LockContentsViewUnitTest, DetachableBaseErrorClearsAuthError) { ...@@ -1164,14 +1163,14 @@ TEST_F(LockContentsViewUnitTest, DetachableBaseErrorClearsAuthError) {
TEST_F(LockContentsViewUnitTest, AuthErrorDoesNotRemoveDetachableBaseError) { TEST_F(LockContentsViewUnitTest, AuthErrorDoesNotRemoveDetachableBaseError) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
// Build lock screen with a single user. // Build lock screen with a single user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(1); SetUserCount(1);
const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id; const AccountId& kUserAccountId = users()[0]->basic_user_info->account_id;
...@@ -1343,8 +1342,8 @@ TEST_F(LockContentsViewUnitTest, SwapAuthAndPublicAccountUserInTwoUserLayout) { ...@@ -1343,8 +1342,8 @@ TEST_F(LockContentsViewUnitTest, SwapAuthAndPublicAccountUserInTwoUserLayout) {
// user. // user.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
AddPublicAccountUsers(1); AddPublicAccountUsers(1);
AddUsers(1); AddUsers(1);
...@@ -1404,8 +1403,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) { ...@@ -1404,8 +1403,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) {
// users. // users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
AddPublicAccountUsers(2); AddPublicAccountUsers(2);
AddUsers(2); AddUsers(2);
...@@ -1530,8 +1529,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) { ...@@ -1530,8 +1529,8 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) {
TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) { TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
AddUsers(2); AddUsers(2);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -1560,8 +1559,8 @@ TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) { ...@@ -1560,8 +1559,8 @@ TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) {
TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) { TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
auto do_test = [&](AuthTarget auth_target) { auto do_test = [&](AuthTarget auth_target) {
...@@ -1603,8 +1602,8 @@ TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) { ...@@ -1603,8 +1602,8 @@ TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) {
TEST_F(LockContentsViewUnitTest, UserListUserSwapFocusesPassword) { TEST_F(LockContentsViewUnitTest, UserListUserSwapFocusesPassword) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi contents_test_api(contents); LockContentsView::TestApi contents_test_api(contents);
AddUsers(3); AddUsers(3);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -1625,12 +1624,12 @@ TEST_F(LockContentsViewUnitTest, UserListUserSwapFocusesPassword) { ...@@ -1625,12 +1624,12 @@ TEST_F(LockContentsViewUnitTest, UserListUserSwapFocusesPassword) {
TEST_F(LockContentsViewUnitTest, BadDetachableBaseUnfocusesPasswordView) { TEST_F(LockContentsViewUnitTest, BadDetachableBaseUnfocusesPasswordView) {
auto fake_detachable_base_model = auto fake_detachable_base_model =
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher()); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
FakeLoginDetachableBaseModel* detachable_base_model = FakeLoginDetachableBaseModel* detachable_base_model =
fake_detachable_base_model.get(); fake_detachable_base_model.get();
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), std::move(fake_detachable_base_model)); DataDispatcher(), std::move(fake_detachable_base_model));
SetUserCount(3); SetUserCount(3);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
...@@ -1659,8 +1658,8 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) { ...@@ -1659,8 +1658,8 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) {
// users. // users.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
LockContentsView::TestApi lock_contents(contents); LockContentsView::TestApi lock_contents(contents);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
AddPublicAccountUsers(1); AddPublicAccountUsers(1);
...@@ -1699,8 +1698,8 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) { ...@@ -1699,8 +1698,8 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) {
TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) { TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -1722,7 +1721,7 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) { ...@@ -1722,7 +1721,7 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) {
EXPECT_FALSE(disabled_auth_message->visible()); EXPECT_FALSE(disabled_auth_message->visible());
// Setting auth disabled will hide the password field and the note action // Setting auth disabled will hide the password field and the note action
// button, and show the message. // button, and show the message.
data_dispatcher()->SetAuthEnabledForUser( DataDispatcher()->SetAuthEnabledForUser(
kFirstUserAccountId, false, kFirstUserAccountId, false,
base::Time::Now() + base::TimeDelta::FromHours(8)); base::Time::Now() + base::TimeDelta::FromHours(8));
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
...@@ -1730,15 +1729,15 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) { ...@@ -1730,15 +1729,15 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) {
EXPECT_FALSE(pin_view->visible()); EXPECT_FALSE(pin_view->visible());
EXPECT_TRUE(disabled_auth_message->visible()); EXPECT_TRUE(disabled_auth_message->visible());
// Setting auth enabled will hide the message and show the password field. // Setting auth enabled will hide the message and show the password field.
data_dispatcher()->SetAuthEnabledForUser(kFirstUserAccountId, true, DataDispatcher()->SetAuthEnabledForUser(kFirstUserAccountId, true,
base::nullopt); base::nullopt);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
EXPECT_TRUE(password_view->visible()); EXPECT_TRUE(password_view->visible());
EXPECT_FALSE(pin_view->visible()); EXPECT_FALSE(pin_view->visible());
EXPECT_FALSE(disabled_auth_message->visible()); EXPECT_FALSE(disabled_auth_message->visible());
// Set auth disabled again. // Set auth disabled again.
data_dispatcher()->SetAuthEnabledForUser( DataDispatcher()->SetAuthEnabledForUser(
kFirstUserAccountId, false, kFirstUserAccountId, false,
base::Time::Now() + base::TimeDelta::FromHours(8)); base::Time::Now() + base::TimeDelta::FromHours(8));
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
...@@ -1746,14 +1745,14 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) { ...@@ -1746,14 +1745,14 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) {
EXPECT_FALSE(pin_view->visible()); EXPECT_FALSE(pin_view->visible());
EXPECT_TRUE(disabled_auth_message->visible()); EXPECT_TRUE(disabled_auth_message->visible());
// Enable PIN. There's no UI change because auth is currently disabled. // Enable PIN. There's no UI change because auth is currently disabled.
data_dispatcher()->SetPinEnabledForUser(kFirstUserAccountId, true); DataDispatcher()->SetPinEnabledForUser(kFirstUserAccountId, true);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
EXPECT_FALSE(password_view->visible()); EXPECT_FALSE(password_view->visible());
EXPECT_FALSE(pin_view->visible()); EXPECT_FALSE(pin_view->visible());
EXPECT_TRUE(disabled_auth_message->visible()); EXPECT_TRUE(disabled_auth_message->visible());
// Set auth enabled again. Both password field and PIN keyboard are shown. // Set auth enabled again. Both password field and PIN keyboard are shown.
data_dispatcher()->SetAuthEnabledForUser(kFirstUserAccountId, true, DataDispatcher()->SetAuthEnabledForUser(kFirstUserAccountId, true,
base::nullopt); base::nullopt);
EXPECT_FALSE(note_action_button->visible()); EXPECT_FALSE(note_action_button->visible());
EXPECT_TRUE(password_view->visible()); EXPECT_TRUE(password_view->visible());
EXPECT_TRUE(pin_view->visible()); EXPECT_TRUE(pin_view->visible());
...@@ -1763,8 +1762,8 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) { ...@@ -1763,8 +1762,8 @@ TEST_F(LockContentsViewUnitTest, OnUnlockAllowedForUserChanged) {
TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) { TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -1777,7 +1776,7 @@ TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) { ...@@ -1777,7 +1776,7 @@ TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) {
LoginUserView* user_view = auth_test_api.user_view(); LoginUserView* user_view = auth_test_api.user_view();
// The message is visible after disabling auth and it receives initial focus. // The message is visible after disabling auth and it receives initial focus.
data_dispatcher()->SetAuthEnabledForUser( DataDispatcher()->SetAuthEnabledForUser(
kFirstUserAccountId, false, kFirstUserAccountId, false,
base::Time::Now() + base::TimeDelta::FromHours(8)); base::Time::Now() + base::TimeDelta::FromHours(8));
EXPECT_TRUE(disabled_auth_message->visible()); EXPECT_TRUE(disabled_auth_message->visible());
...@@ -1951,8 +1950,8 @@ TEST_F(LockContentsViewUnitTest, UserSwapFocusesBigView) { ...@@ -1951,8 +1950,8 @@ TEST_F(LockContentsViewUnitTest, UserSwapFocusesBigView) {
TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) { TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -1969,8 +1968,8 @@ TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) { ...@@ -1969,8 +1968,8 @@ TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) {
TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) { TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(2); SetUserCount(2);
SetWidget(CreateWidgetWithContent(contents)); SetWidget(CreateWidgetWithContent(contents));
...@@ -1979,7 +1978,7 @@ TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) { ...@@ -1979,7 +1978,7 @@ TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) {
AccountId primary_user = test_api.primary_big_view() AccountId primary_user = test_api.primary_big_view()
->GetCurrentUser() ->GetCurrentUser()
->basic_user_info->account_id; ->basic_user_info->account_id;
data_dispatcher()->SetPinEnabledForUser(primary_user, true); DataDispatcher()->SetPinEnabledForUser(primary_user, true);
// This user should be identical to the user we enabled PIN for. // This user should be identical to the user we enabled PIN for.
SetUserCount(1); SetUserCount(1);
...@@ -1994,8 +1993,8 @@ TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) { ...@@ -1994,8 +1993,8 @@ TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) {
// Build lock screen with a single user. // Build lock screen with a single user.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
...@@ -2008,15 +2007,15 @@ TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) { ...@@ -2008,15 +2007,15 @@ TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) {
EXPECT_FALSE(test_api.warning_banner_bubble()->IsVisible()); EXPECT_FALSE(test_api.warning_banner_bubble()->IsVisible());
// Verifies that a warning banner is shown by giving a non-empty message. // Verifies that a warning banner is shown by giving a non-empty message.
data_dispatcher()->ShowWarningBanner(base::ASCIIToUTF16("foo")); DataDispatcher()->ShowWarningBanner(base::ASCIIToUTF16("foo"));
EXPECT_TRUE(test_api.warning_banner_bubble()->IsVisible()); EXPECT_TRUE(test_api.warning_banner_bubble()->IsVisible());
// Verifies that a warning banner is hidden by HideWarningBanner(). // Verifies that a warning banner is hidden by HideWarningBanner().
data_dispatcher()->HideWarningBanner(); DataDispatcher()->HideWarningBanner();
EXPECT_FALSE(test_api.warning_banner_bubble()->IsVisible()); EXPECT_FALSE(test_api.warning_banner_bubble()->IsVisible());
// Shows a warning banner again. // Shows a warning banner again.
data_dispatcher()->ShowWarningBanner(base::ASCIIToUTF16("foo")); DataDispatcher()->ShowWarningBanner(base::ASCIIToUTF16("foo"));
EXPECT_TRUE(test_api.warning_banner_bubble()->IsVisible()); EXPECT_TRUE(test_api.warning_banner_bubble()->IsVisible());
// Attempt and fail user auth - an auth error is expected to be shown. // Attempt and fail user auth - an auth error is expected to be shown.
...@@ -2042,12 +2041,12 @@ TEST_F(LockContentsViewUnitTest, RemoveUserFocusMovesBackToPrimaryUser) { ...@@ -2042,12 +2041,12 @@ TEST_F(LockContentsViewUnitTest, RemoveUserFocusMovesBackToPrimaryUser) {
// Build lock screen with one public account and one normal user. // Build lock screen with one public account and one normal user.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
AddPublicAccountUsers(1); AddPublicAccountUsers(1);
AddUsers(1); AddUsers(1);
users()[1]->can_remove = true; users()[1]->can_remove = true;
data_dispatcher()->NotifyUsers(users()); DataDispatcher()->NotifyUsers(users());
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
LockContentsView::TestApi test_api(lock); LockContentsView::TestApi test_api(lock);
...@@ -2085,8 +2084,8 @@ TEST_F(LockContentsViewUnitTest, ...@@ -2085,8 +2084,8 @@ TEST_F(LockContentsViewUnitTest,
// Show lock screen with one normal user. // Show lock screen with one normal user.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
AddUsers(1); AddUsers(1);
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
...@@ -2096,7 +2095,7 @@ TEST_F(LockContentsViewUnitTest, ...@@ -2096,7 +2095,7 @@ TEST_F(LockContentsViewUnitTest,
Shell::Get()->backlights_forced_off_setter()->backlights_forced_off()); Shell::Get()->backlights_forced_off_setter()->backlights_forced_off());
// Change fingerprint state; backlights remain forced off. // Change fingerprint state; backlights remain forced off.
data_dispatcher()->SetFingerprintState( DataDispatcher()->SetFingerprintState(
users()[0]->basic_user_info->account_id, users()[0]->basic_user_info->account_id,
mojom::FingerprintState::DISABLED_FROM_ATTEMPTS); mojom::FingerprintState::DISABLED_FROM_ATTEMPTS);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -2116,8 +2115,8 @@ TEST_F(LockContentsViewUnitTest, ...@@ -2116,8 +2115,8 @@ TEST_F(LockContentsViewUnitTest,
// Show lock screen with one normal user. // Show lock screen with one normal user.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
AddUsers(1); AddUsers(1);
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
...@@ -2128,7 +2127,7 @@ TEST_F(LockContentsViewUnitTest, ...@@ -2128,7 +2127,7 @@ TEST_F(LockContentsViewUnitTest,
// Validate a fingerprint authentication attempt resets backlights being // Validate a fingerprint authentication attempt resets backlights being
// forced off. // forced off.
data_dispatcher()->NotifyFingerprintAuthResult( DataDispatcher()->NotifyFingerprintAuthResult(
users()[0]->basic_user_info->account_id, false /*successful*/); users()[0]->basic_user_info->account_id, false /*successful*/);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_FALSE( EXPECT_FALSE(
...@@ -2141,8 +2140,8 @@ TEST_F(LockContentsViewUnitTest, RightAndLeftAcceleratorsWithNoUser) { ...@@ -2141,8 +2140,8 @@ TEST_F(LockContentsViewUnitTest, RightAndLeftAcceleratorsWithNoUser) {
// Show lock screen but do *not* initialize any users. // Show lock screen but do *not* initialize any users.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetWidget(CreateWidgetWithContent(lock)); SetWidget(CreateWidgetWithContent(lock));
// Nothing to validate except that there is no crash. // Nothing to validate except that there is no crash.
......
...@@ -75,8 +75,8 @@ TEST_F(LockScreenSanityTest, PasswordIsInitiallyFocused) { ...@@ -75,8 +75,8 @@ TEST_F(LockScreenSanityTest, PasswordIsInitiallyFocused) {
// Build lock screen. // Build lock screen.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
// The lock screen requires at least one user. // The lock screen requires at least one user.
SetUserCount(1); SetUserCount(1);
...@@ -94,8 +94,8 @@ TEST_F(LockScreenSanityTest, PasswordSubmitCallsLoginScreenClient) { ...@@ -94,8 +94,8 @@ TEST_F(LockScreenSanityTest, PasswordSubmitCallsLoginScreenClient) {
// Build lock screen. // Build lock screen.
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
// The lock screen requires at least one user. // The lock screen requires at least one user.
SetUserCount(1); SetUserCount(1);
...@@ -122,8 +122,8 @@ TEST_F(LockScreenSanityTest, ...@@ -122,8 +122,8 @@ TEST_F(LockScreenSanityTest,
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
LoginPasswordView::TestApi password_test_api = LoginPasswordView::TestApi password_test_api =
...@@ -179,8 +179,8 @@ TEST_F(LockScreenSanityTest, TabGoesFromLockToShelfAndBackToLock) { ...@@ -179,8 +179,8 @@ TEST_F(LockScreenSanityTest, TabGoesFromLockToShelfAndBackToLock) {
// Create lock screen. // Create lock screen.
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
views::View* shelf = Shelf::ForWindow(lock->GetWidget()->GetNativeWindow()) views::View* shelf = Shelf::ForWindow(lock->GetWidget()->GetNativeWindow())
...@@ -212,8 +212,8 @@ TEST_F(LockScreenSanityTest, ShiftTabGoesFromLockToStatusAreaAndBackToLock) { ...@@ -212,8 +212,8 @@ TEST_F(LockScreenSanityTest, ShiftTabGoesFromLockToStatusAreaAndBackToLock) {
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
views::View* status_area = views::View* status_area =
...@@ -243,8 +243,8 @@ TEST_F(LockScreenSanityTest, TabWithLockScreenAppActive) { ...@@ -243,8 +243,8 @@ TEST_F(LockScreenSanityTest, TabWithLockScreenAppActive) {
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
...@@ -260,7 +260,7 @@ TEST_F(LockScreenSanityTest, TabWithLockScreenAppActive) { ...@@ -260,7 +260,7 @@ TEST_F(LockScreenSanityTest, TabWithLockScreenAppActive) {
LoginScreenController* controller = Shell::Get()->login_screen_controller(); LoginScreenController* controller = Shell::Get()->login_screen_controller();
// Initialize lock screen action state. // Initialize lock screen action state.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive);
// Create and focus a lock screen app window. // Create and focus a lock screen app window.
auto* lock_screen_app = new views::View(); auto* lock_screen_app = new views::View();
...@@ -315,8 +315,8 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) { ...@@ -315,8 +315,8 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) {
session_manager::SessionState::LOCKED); session_manager::SessionState::LOCKED);
auto* lock = new LockContentsView( auto* lock = new LockContentsView(
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
...@@ -325,7 +325,7 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) { ...@@ -325,7 +325,7 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) {
->GetContentsView(); ->GetContentsView();
// Setup and focus a lock screen app. // Setup and focus a lock screen app.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kActive);
auto* lock_screen_app = new views::View(); auto* lock_screen_app = new views::View();
lock_screen_app->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); lock_screen_app->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
std::unique_ptr<views::Widget> app_widget = std::unique_ptr<views::Widget> app_widget =
...@@ -340,7 +340,7 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) { ...@@ -340,7 +340,7 @@ TEST_F(LockScreenSanityTest, FocusLockScreenWhenLockScreenAppExit) {
// Move the lock screen note taking to available state (which happens when the // Move the lock screen note taking to available state (which happens when the
// app session ends) - this should focus the lock screen. // app session ends) - this should focus the lock screen.
data_dispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable); DataDispatcher()->SetLockScreenNoteState(mojom::TrayActionState::kAvailable);
EXPECT_TRUE(VerifyFocused(lock)); EXPECT_TRUE(VerifyFocused(lock));
// Tab through the lock screen - the focus should eventually get to the shelf. // Tab through the lock screen - the focus should eventually get to the shelf.
...@@ -355,14 +355,14 @@ TEST_F(LockScreenSanityTest, RemoveUser) { ...@@ -355,14 +355,14 @@ TEST_F(LockScreenSanityTest, RemoveUser) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
// Add two users, the first of which can be removed. // Add two users, the first of which can be removed.
users().push_back(CreateUser("test1@test")); users().push_back(CreateUser("test1@test"));
users()[0]->can_remove = true; users()[0]->can_remove = true;
users().push_back(CreateUser("test2@test")); users().push_back(CreateUser("test2@test"));
data_dispatcher()->NotifyUsers(users()); DataDispatcher()->NotifyUsers(users());
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
......
...@@ -110,7 +110,7 @@ void LoginTestBase::SetUserCount(size_t count) { ...@@ -110,7 +110,7 @@ void LoginTestBase::SetUserCount(size_t count) {
users_.erase(users_.begin() + count, users_.end()); users_.erase(users_.begin() + count, users_.end());
// Notify any listeners that the user count has changed. // Notify any listeners that the user count has changed.
data_dispatcher()->NotifyUsers(users_); DataDispatcher()->NotifyUsers(users_);
} }
void LoginTestBase::AddUsers(size_t num_users) { void LoginTestBase::AddUsers(size_t num_users) {
...@@ -121,12 +121,12 @@ void LoginTestBase::AddUsers(size_t num_users) { ...@@ -121,12 +121,12 @@ void LoginTestBase::AddUsers(size_t num_users) {
} }
// Notify any listeners that the user count has changed. // Notify any listeners that the user count has changed.
data_dispatcher()->NotifyUsers(users_); DataDispatcher()->NotifyUsers(users_);
} }
void LoginTestBase::AddUserByEmail(const std::string& email) { void LoginTestBase::AddUserByEmail(const std::string& email) {
users_.push_back(CreateUser(email)); users_.push_back(CreateUser(email));
data_dispatcher()->NotifyUsers(users_); DataDispatcher()->NotifyUsers(users_);
} }
void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) { void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) {
...@@ -137,10 +137,10 @@ void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) { ...@@ -137,10 +137,10 @@ void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) {
} }
// Notify any listeners that the user count has changed. // Notify any listeners that the user count has changed.
data_dispatcher()->NotifyUsers(users_); DataDispatcher()->NotifyUsers(users_);
} }
LoginDataDispatcher* LoginTestBase::data_dispatcher() { LoginDataDispatcher* LoginTestBase::DataDispatcher() {
return LockScreen::HasInstance() ? LockScreen::Get()->data_dispatcher() return LockScreen::HasInstance() ? LockScreen::Get()->data_dispatcher()
: &data_dispatcher_; : &data_dispatcher_;
} }
......
...@@ -44,12 +44,12 @@ class LoginTestBase : public AshTestBase { ...@@ -44,12 +44,12 @@ class LoginTestBase : public AshTestBase {
// shown. // shown.
std::unique_ptr<views::Widget> CreateWidgetWithContent(views::View* content); std::unique_ptr<views::Widget> CreateWidgetWithContent(views::View* content);
// Changes the active number of users. Fires an event on |data_dispatcher()|. // Changes the active number of users. Fires an event on |DataDispatcher()|.
void SetUserCount(size_t count); void SetUserCount(size_t count);
// Append number of |num_users| regular auth users. // Append number of |num_users| regular auth users.
// Changes the active number of users. Fires an event on // Changes the active number of users. Fires an event on
// |data_dispatcher()|. // |DataDispatcher()|.
void AddUsers(size_t num_users); void AddUsers(size_t num_users);
// Add a single user with the specified |email|. // Add a single user with the specified |email|.
...@@ -57,7 +57,7 @@ class LoginTestBase : public AshTestBase { ...@@ -57,7 +57,7 @@ class LoginTestBase : public AshTestBase {
// Append number of |num_public_accounts| public account users. // Append number of |num_public_accounts| public account users.
// Changes the active number of users. Fires an event on // Changes the active number of users. Fires an event on
// |data_dispatcher()|. // |DataDispatcher()|.
void AddPublicAccountUsers(size_t num_public_accounts); void AddPublicAccountUsers(size_t num_public_accounts);
std::vector<mojom::LoginUserInfoPtr>& users() { return users_; } std::vector<mojom::LoginUserInfoPtr>& users() { return users_; }
...@@ -66,8 +66,7 @@ class LoginTestBase : public AshTestBase { ...@@ -66,8 +66,7 @@ class LoginTestBase : public AshTestBase {
// If the LockScreen is instantiated, returns its data dispatcher. Otherwise, // If the LockScreen is instantiated, returns its data dispatcher. Otherwise,
// returns a standalone instance. // returns a standalone instance.
// TODO(crbug/906676): rename this method to DataDispatcher. LoginDataDispatcher* DataDispatcher();
LoginDataDispatcher* data_dispatcher();
// AshTestBase: // AshTestBase:
void TearDown() override; void TearDown() override;
......
...@@ -85,8 +85,8 @@ TEST_F(LoginMetricsRecorderTest, NoteActionButtonClick) { ...@@ -85,8 +85,8 @@ TEST_F(LoginMetricsRecorderTest, NoteActionButtonClick) {
auto* contents = new LockContentsView( auto* contents = new LockContentsView(
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock, mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
data_dispatcher(), DataDispatcher(),
std::make_unique<FakeLoginDetachableBaseModel>(data_dispatcher())); std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
SetUserCount(1); SetUserCount(1);
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents); std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment