Commit f005a035 authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

cros: Move non-keyboard functionality out of LoginKeyboardTestBase

As part of this CL, we move LockScreen control and user account functions into
LoginTestBase and make LoginKeyboardTestBase a subclass. In the future, test
fixtures with new login-related functionality can inherit from LoginTestBase.

Bug: 809330
Change-Id: I0d082a60e667fec7fd391984de6469ead5d57e77
Reviewed-on: https://chromium-review.googlesource.com/c/1338476Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609363}
parent 563d6a00
...@@ -377,7 +377,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, ...@@ -377,7 +377,7 @@ TEST_F(LockContentsViewKeyboardUnitTest,
LockContentsView* contents = LockContentsView* contents =
LockScreen::TestApi(LockScreen::Get()).contents_view(); LockScreen::TestApi(LockScreen::Get()).contents_view();
ASSERT_NE(nullptr, contents); ASSERT_NE(nullptr, contents);
LoadUsers(9); SetUserCount(9);
// Users list in extra small layout should adjust its height to parent. // Users list in extra small layout should adjust its height to parent.
ScrollableUsersListView* users_list = ScrollableUsersListView* users_list =
...@@ -399,7 +399,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, AutoLayoutSmallUsersListForKeyboard) { ...@@ -399,7 +399,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, AutoLayoutSmallUsersListForKeyboard) {
LockContentsView* contents = LockContentsView* contents =
LockScreen::TestApi(LockScreen::Get()).contents_view(); LockScreen::TestApi(LockScreen::Get()).contents_view();
ASSERT_NE(nullptr, contents); ASSERT_NE(nullptr, contents);
LoadUsers(4); SetUserCount(4);
ScrollableUsersListView* users_list = ScrollableUsersListView* users_list =
LockContentsView::TestApi(contents).users_list(); LockContentsView::TestApi(contents).users_list();
...@@ -1231,7 +1231,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, SwitchPinAndVirtualKeyboard) { ...@@ -1231,7 +1231,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, SwitchPinAndVirtualKeyboard) {
// Add user who can use pin authentication. // Add user who can use pin authentication.
const std::string email = "user@domain.com"; const std::string email = "user@domain.com";
LoadUser(email); AddUserByEmail(email);
contents->OnPinEnabledForUserChanged(AccountId::FromUserEmail(email), true); contents->OnPinEnabledForUserChanged(AccountId::FromUserEmail(email), true);
LoginBigUserView* big_view = LoginBigUserView* big_view =
LockContentsView::TestApi(contents).primary_big_view(); LockContentsView::TestApi(contents).primary_big_view();
...@@ -1259,7 +1259,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, SwitchUserWhileKeyboardShown) { ...@@ -1259,7 +1259,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, SwitchUserWhileKeyboardShown) {
LockScreen::TestApi(LockScreen::Get()).contents_view(); LockScreen::TestApi(LockScreen::Get()).contents_view();
ASSERT_NE(nullptr, contents); ASSERT_NE(nullptr, contents);
LoadUsers(2); SetUserCount(2);
LoginAuthUserView::TestApi primary_user( LoginAuthUserView::TestApi primary_user(
LockContentsView::TestApi(contents).primary_big_view()->auth_user()); LockContentsView::TestApi(contents).primary_big_view()->auth_user());
...@@ -1305,7 +1305,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, PinSubmitWithVirtualKeyboardShown) { ...@@ -1305,7 +1305,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, PinSubmitWithVirtualKeyboardShown) {
// Add user who can use pin authentication. // Add user who can use pin authentication.
const std::string email = "user@domain.com"; const std::string email = "user@domain.com";
LoadUser(email); AddUserByEmail(email);
contents->OnPinEnabledForUserChanged(AccountId::FromUserEmail(email), true); contents->OnPinEnabledForUserChanged(AccountId::FromUserEmail(email), true);
LoginBigUserView* big_view = LoginBigUserView* big_view =
LockContentsView::TestApi(contents).primary_big_view(); LockContentsView::TestApi(contents).primary_big_view();
...@@ -1799,14 +1799,13 @@ TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) { ...@@ -1799,14 +1799,13 @@ TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) {
EXPECT_TRUE(HasFocusInAnyChildView(status_area)); EXPECT_TRUE(HasFocusInAnyChildView(status_area));
} }
class LockContentsViewPowerManagerUnitTest class LockContentsViewPowerManagerUnitTest : public LockContentsViewUnitTest {
: public LockContentsViewKeyboardUnitTest {
public: public:
void SetUp() override { void SetUp() override {
chromeos::DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient( chromeos::DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient(
std::make_unique<chromeos::FakePowerManagerClient>()); std::make_unique<chromeos::FakePowerManagerClient>());
LockContentsViewKeyboardUnitTest::SetUp(); LockContentsViewUnitTest::SetUp();
} }
}; };
...@@ -1831,9 +1830,9 @@ TEST_F(LockContentsViewPowerManagerUnitTest, ...@@ -1831,9 +1830,9 @@ TEST_F(LockContentsViewPowerManagerUnitTest,
// Verifies that the password box for the active user is cleared if a suspend // Verifies that the password box for the active user is cleared if a suspend
// event is received. // event is received.
TEST_F(LockContentsViewKeyboardUnitTest, PasswordClearedOnSuspend) { TEST_F(LockContentsViewUnitTest, PasswordClearedOnSuspend) {
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen()); ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
LoadUsers(1); AddUsers(1);
LockScreen::TestApi lock_screen = LockScreen::TestApi(LockScreen::Get()); LockScreen::TestApi lock_screen = LockScreen::TestApi(LockScreen::Get());
LockContentsView* contents = lock_screen.contents_view(); LockContentsView* contents = lock_screen.contents_view();
...@@ -1851,9 +1850,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, PasswordClearedOnSuspend) { ...@@ -1851,9 +1850,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, PasswordClearedOnSuspend) {
EXPECT_TRUE(textfield->text().empty()); EXPECT_TRUE(textfield->text().empty());
} }
TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavSingleUser) { TEST_F(LockContentsViewUnitTest, ArrowNavSingleUser) {
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen()); ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
LoadUsers(1); SetUserCount(1);
LockContentsView* lock_contents = LockContentsView* lock_contents =
LockScreen::TestApi(LockScreen::Get()).contents_view(); LockScreen::TestApi(LockScreen::Get()).contents_view();
...@@ -1869,10 +1868,10 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavSingleUser) { ...@@ -1869,10 +1868,10 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavSingleUser) {
EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_big_view)); EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_big_view));
} }
TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavTwoUsers) { TEST_F(LockContentsViewUnitTest, ArrowNavTwoUsers) {
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen()); ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
LoadUsers(1); AddUsers(1);
LoadPublicAccountUsers(1); AddPublicAccountUsers(1);
LockContentsView::TestApi lock_contents = LockContentsView::TestApi( LockContentsView::TestApi lock_contents = LockContentsView::TestApi(
LockScreen::TestApi(LockScreen::Get()).contents_view()); LockScreen::TestApi(LockScreen::Get()).contents_view());
...@@ -1899,9 +1898,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavTwoUsers) { ...@@ -1899,9 +1898,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavTwoUsers) {
EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_password_view)); EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_password_view));
} }
TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavThreeUsers) { TEST_F(LockContentsViewUnitTest, ArrowNavThreeUsers) {
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen()); ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
LoadUsers(3); SetUserCount(3);
LockContentsView::TestApi lock_contents = LockContentsView::TestApi( LockContentsView::TestApi lock_contents = LockContentsView::TestApi(
LockScreen::TestApi(LockScreen::Get()).contents_view()); LockScreen::TestApi(LockScreen::Get()).contents_view());
...@@ -1932,9 +1931,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavThreeUsers) { ...@@ -1932,9 +1931,9 @@ TEST_F(LockContentsViewKeyboardUnitTest, ArrowNavThreeUsers) {
EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_password_view)); EXPECT_TRUE(login_views_utils::HasFocusInAnyChildView(primary_password_view));
} }
TEST_F(LockContentsViewKeyboardUnitTest, UserSwapFocusesBigView) { TEST_F(LockContentsViewUnitTest, UserSwapFocusesBigView) {
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen()); ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
LoadUsers(3); SetUserCount(3);
LockContentsView::TestApi lock_contents = LockContentsView::TestApi( LockContentsView::TestApi lock_contents = LockContentsView::TestApi(
LockScreen::TestApi(LockScreen::Get()).contents_view()); LockScreen::TestApi(LockScreen::Get()).contents_view());
......
...@@ -21,7 +21,7 @@ TEST_F(LockWindowVirtualKeyboardTest, VirtualKeyboardDoesNotCoverAuthView) { ...@@ -21,7 +21,7 @@ TEST_F(LockWindowVirtualKeyboardTest, VirtualKeyboardDoesNotCoverAuthView) {
LockScreen::TestApi(LockScreen::Get()).contents_view(); LockScreen::TestApi(LockScreen::Get()).contents_view();
ASSERT_NE(nullptr, lock_contents); ASSERT_NE(nullptr, lock_contents);
LoadUsers(1); SetUserCount(1);
LoginBigUserView* auth_view = LoginBigUserView* auth_view =
MakeLockContentsViewTestApi(lock_contents).primary_big_view(); MakeLockContentsViewTestApi(lock_contents).primary_big_view();
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "ash/login/ui/login_keyboard_test_base.h" #include "ash/login/ui/login_keyboard_test_base.h"
#include "ash/keyboard/ash_keyboard_controller.h" #include "ash/keyboard/ash_keyboard_controller.h"
#include "ash/login/login_screen_controller.h"
#include "ash/login/mock_login_screen_client.h" #include "ash/login/mock_login_screen_client.h"
#include "ash/login/ui/lock_screen.h" #include "ash/login/ui/lock_screen.h"
#include "ash/login/ui/login_test_utils.h" #include "ash/login/ui/login_test_utils.h"
...@@ -29,19 +28,15 @@ LoginKeyboardTestBase::~LoginKeyboardTestBase() = default; ...@@ -29,19 +28,15 @@ LoginKeyboardTestBase::~LoginKeyboardTestBase() = default;
void LoginKeyboardTestBase::SetUp() { void LoginKeyboardTestBase::SetUp() {
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kEnableVirtualKeyboard); keyboard::switches::kEnableVirtualKeyboard);
AshTestBase::SetUp(); LoginTestBase::SetUp();
login_controller_ = Shell::Get()->login_screen_controller();
ASSERT_NE(nullptr, login_controller_);
Shell::Get()->ash_keyboard_controller()->ActivateKeyboard(); Shell::Get()->ash_keyboard_controller()->ActivateKeyboard();
} }
void LoginKeyboardTestBase::TearDown() { void LoginKeyboardTestBase::TearDown() {
Shell::Get()->ash_keyboard_controller()->DeactivateKeyboard(); Shell::Get()->ash_keyboard_controller()->DeactivateKeyboard();
if (ash::LockScreen::HasInstance())
ash::LockScreen::Get()->Destroy(); LoginTestBase::TearDown();
AshTestBase::TearDown();
} }
void LoginKeyboardTestBase::ShowKeyboard() { void LoginKeyboardTestBase::ShowKeyboard() {
...@@ -68,57 +63,4 @@ gfx::Rect LoginKeyboardTestBase::GetKeyboardBoundsInScreen() const { ...@@ -68,57 +63,4 @@ gfx::Rect LoginKeyboardTestBase::GetKeyboardBoundsInScreen() const {
->GetBoundsInScreen(); ->GetBoundsInScreen();
} }
void LoginKeyboardTestBase::ShowLockScreen() {
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::LOCKED);
// The lock screen can't be shown without a wallpaper.
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
base::Optional<bool> result;
login_controller_->ShowLockScreen(base::BindOnce(
[](base::Optional<bool>* result, bool did_show) { *result = did_show; },
&result));
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(result.has_value());
ASSERT_EQ(*result, true);
}
void LoginKeyboardTestBase::ShowLoginScreen() {
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::LOGIN_PRIMARY);
// The login screen can't be shown without a wallpaper.
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
base::Optional<bool> result;
login_controller_->ShowLoginScreen(base::BindOnce(
[](base::Optional<bool>* result, bool did_show) { *result = did_show; },
&result));
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(result.has_value());
ASSERT_EQ(*result, true);
}
void LoginKeyboardTestBase::LoadUsers(int count) {
for (int i = 0; i < count; ++i) {
std::string email =
base::StrCat({"user", std::to_string(i), "@domain.com "});
users_.push_back(CreateUser(email));
}
ash::LockScreen::Get()->data_dispatcher()->NotifyUsers(users_);
}
void LoginKeyboardTestBase::LoadPublicAccountUsers(int count) {
for (int i = 0; i < count; ++i) {
std::string email =
base::StrCat({"publicuser", std::to_string(i), "@domain.com"});
users_.push_back(CreatePublicAccountUser(email));
}
ash::LockScreen::Get()->data_dispatcher()->NotifyUsers(users_);
}
void LoginKeyboardTestBase::LoadUser(const std::string& email) {
users_.push_back(CreateUser(email));
ash::LockScreen::Get()->data_dispatcher()->NotifyUsers(users_);
}
} // namespace ash } // namespace ash
...@@ -7,16 +7,15 @@ ...@@ -7,16 +7,15 @@
#include <memory> #include <memory>
#include "ash/login/ui/login_test_base.h"
#include "ash/public/interfaces/login_user_info.mojom.h" #include "ash/public/interfaces/login_user_info.mojom.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
namespace ash { namespace ash {
class LoginScreenController;
// Base test fixture for testing the views-based login and lock screens with // Base test fixture for testing the views-based login and lock screens with
// virtual keyboard. // virtual keyboard.
class LoginKeyboardTestBase : public AshTestBase { class LoginKeyboardTestBase : public LoginTestBase {
public: public:
LoginKeyboardTestBase(); LoginKeyboardTestBase();
~LoginKeyboardTestBase() override; ~LoginKeyboardTestBase() override;
...@@ -33,29 +32,11 @@ class LoginKeyboardTestBase : public AshTestBase { ...@@ -33,29 +32,11 @@ class LoginKeyboardTestBase : public AshTestBase {
// Returns bounds of the keyboard in screen coordinate space. // Returns bounds of the keyboard in screen coordinate space.
gfx::Rect GetKeyboardBoundsInScreen() const; gfx::Rect GetKeyboardBoundsInScreen() const;
// Shows lock screen. Asserts that lock screen is shown. To stop execution of
// the test on failed assertion use ASSERT_NO_FATAL_FAILURE macro.
void ShowLockScreen();
// Shows login screen. Asserts that login screen is shown. To stop execution
// of the test on failed assertion use ASSERT_NO_FATAL_FAILURE macro.
void ShowLoginScreen();
// Loads the number of test users specified by |count|.
void LoadUsers(int count);
// Loads the number of test public account users specified by |count|.
void LoadPublicAccountUsers(int count);
// Loads user with the specified |email|.
void LoadUser(const std::string& email);
// AshTestBase: // AshTestBase:
void SetUp() override; void SetUp() override;
void TearDown() override; void TearDown() override;
private: private:
LoginScreenController* login_controller_ = nullptr;
std::vector<mojom::LoginUserInfoPtr> users_; std::vector<mojom::LoginUserInfoPtr> users_;
DISALLOW_COPY_AND_ASSIGN(LoginKeyboardTestBase); DISALLOW_COPY_AND_ASSIGN(LoginKeyboardTestBase);
......
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
#include <string> #include <string>
#include "ash/login/login_screen_controller.h"
#include "ash/login/ui/lock_screen.h"
#include "ash/login/ui/login_test_utils.h" #include "ash/login/ui/login_test_utils.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/interfaces/tray_action.mojom.h" #include "ash/public/interfaces/tray_action.mojom.h"
#include "ash/session/test_session_controller_client.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wallpaper/wallpaper_controller.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "services/ws/public/cpp/property_type_converters.h" #include "services/ws/public/cpp/property_type_converters.h"
#include "services/ws/public/mojom/window_manager.mojom.h" #include "services/ws/public/mojom/window_manager.mojom.h"
...@@ -42,6 +46,36 @@ LoginTestBase::LoginTestBase() = default; ...@@ -42,6 +46,36 @@ LoginTestBase::LoginTestBase() = default;
LoginTestBase::~LoginTestBase() = default; LoginTestBase::~LoginTestBase() = default;
void LoginTestBase::ShowLockScreen() {
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::LOCKED);
// The lock screen can't be shown without a wallpaper.
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
base::Optional<bool> result;
Shell::Get()->login_screen_controller()->ShowLockScreen(base::BindOnce(
[](base::Optional<bool>* result, bool did_show) { *result = did_show; },
&result));
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(result.has_value());
ASSERT_EQ(*result, true);
}
void LoginTestBase::ShowLoginScreen() {
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::LOGIN_PRIMARY);
// The login screen can't be shown without a wallpaper.
Shell::Get()->wallpaper_controller()->ShowDefaultWallpaperForTesting();
base::Optional<bool> result;
Shell::Get()->login_screen_controller()->ShowLoginScreen(base::BindOnce(
[](base::Optional<bool>* result, bool did_show) { *result = did_show; },
&result));
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(result.has_value());
ASSERT_EQ(*result, true);
}
void LoginTestBase::SetWidget(std::unique_ptr<views::Widget> widget) { void LoginTestBase::SetWidget(std::unique_ptr<views::Widget> widget) {
EXPECT_FALSE(widget_) << "SetWidget can only be called once."; EXPECT_FALSE(widget_) << "SetWidget can only be called once.";
widget_ = std::move(widget); widget_ = std::move(widget);
...@@ -76,7 +110,7 @@ void LoginTestBase::SetUserCount(size_t count) { ...@@ -76,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_); data_dispatcher()->NotifyUsers(users_);
} }
void LoginTestBase::AddUsers(size_t num_users) { void LoginTestBase::AddUsers(size_t num_users) {
...@@ -87,7 +121,12 @@ void LoginTestBase::AddUsers(size_t num_users) { ...@@ -87,7 +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_); data_dispatcher()->NotifyUsers(users_);
}
void LoginTestBase::AddUserByEmail(const std::string& email) {
users_.push_back(CreateUser(email));
data_dispatcher()->NotifyUsers(users_);
} }
void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) { void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) {
...@@ -98,12 +137,20 @@ void LoginTestBase::AddPublicAccountUsers(size_t num_public_accounts) { ...@@ -98,12 +137,20 @@ 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_); data_dispatcher()->NotifyUsers(users_);
}
LoginDataDispatcher* LoginTestBase::data_dispatcher() {
return LockScreen::HasInstance() ? LockScreen::Get()->data_dispatcher()
: &data_dispatcher_;
} }
void LoginTestBase::TearDown() { void LoginTestBase::TearDown() {
widget_.reset(); widget_.reset();
if (LockScreen::HasInstance())
LockScreen::Get()->Destroy();
AshTestBase::TearDown(); AshTestBase::TearDown();
} }
......
...@@ -26,6 +26,13 @@ class LoginTestBase : public AshTestBase { ...@@ -26,6 +26,13 @@ class LoginTestBase : public AshTestBase {
LoginTestBase(); LoginTestBase();
~LoginTestBase() override; ~LoginTestBase() override;
// Shows a full Lock/Login screen. These methods are useful for when we want
// to test interactions between multiple lock screen components, or when some
// component needs to be able to talk directly to the lockscreen (e.g. getting
// the ScreenType).
void ShowLockScreen();
void ShowLoginScreen();
// Sets the primary test widget. The widget can be retrieved using |widget()|. // Sets the primary test widget. The widget can be retrieved using |widget()|.
// This can be used to make a widget scoped to the whole test, e.g. if the // This can be used to make a widget scoped to the whole test, e.g. if the
// widget is created in a SetUp override. // widget is created in a SetUp override.
...@@ -45,6 +52,9 @@ class LoginTestBase : public AshTestBase { ...@@ -45,6 +52,9 @@ class LoginTestBase : public AshTestBase {
// |data_dispatcher()|. // |data_dispatcher()|.
void AddUsers(size_t num_users); void AddUsers(size_t num_users);
// Add a single user with the specified |email|.
void AddUserByEmail(const std::string& email);
// 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()|. // |data_dispatcher()|.
...@@ -54,7 +64,10 @@ class LoginTestBase : public AshTestBase { ...@@ -54,7 +64,10 @@ class LoginTestBase : public AshTestBase {
const std::vector<mojom::LoginUserInfoPtr>& users() const { return users_; } const std::vector<mojom::LoginUserInfoPtr>& users() const { return users_; }
LoginDataDispatcher* data_dispatcher() { return &data_dispatcher_; } // If the LockScreen is instantiated, returns its data dispatcher. Otherwise,
// returns a standalone instance.
// TODO(crbug/906676): rename this method to DataDispatcher.
LoginDataDispatcher* data_dispatcher();
// AshTestBase: // AshTestBase:
void TearDown() override; void TearDown() override;
......
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