Commit c5e5d39e authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Move UserCloudPolicyManagerTest to use mixin infrastructure

This moves UserCloudPolicyManagerTest to use mixin infrastructure to
set up test environment. This significantly reduces the inheritance
chain for these tests (to UserCloudPolicyManagerTest >
MixinBasedInProcessBrowserTest > InProcessBrowserTest), and makes the
test logic more trackable.

BUG=None

Change-Id: I60000a23c3b0d72cbe18fc101b48b96d09c3f603
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1597174
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657490}
parent d394b006
...@@ -119,7 +119,8 @@ void LoginManagerMixin::CreatedBrowserMainParts( ...@@ -119,7 +119,8 @@ void LoginManagerMixin::CreatedBrowserMainParts(
void LoginManagerMixin::SetUpOnMainThread() { void LoginManagerMixin::SetUpOnMainThread() {
test::UserSessionManagerTestApi session_manager_test_api( test::UserSessionManagerTestApi session_manager_test_api(
UserSessionManager::GetInstance()); UserSessionManager::GetInstance());
session_manager_test_api.SetShouldLaunchBrowserInTests(false); session_manager_test_api.SetShouldLaunchBrowserInTests(
should_launch_browser_);
session_manager_test_api.SetShouldObtainTokenHandleInTests(false); session_manager_test_api.SetShouldObtainTokenHandleInTests(false);
} }
......
...@@ -54,6 +54,11 @@ class LoginManagerMixin : public InProcessBrowserTestMixin { ...@@ -54,6 +54,11 @@ class LoginManagerMixin : public InProcessBrowserTestMixin {
// Should be called before mixin SetUp() is called to take effect. // Should be called before mixin SetUp() is called to take effect.
void set_session_restore_enabled() { session_restore_enabled_ = true; } void set_session_restore_enabled() { session_restore_enabled_ = true; }
// By default, LoginManagerMixin will set up user session manager not to
// launch browser as part of user session setup - use this to override that
// behavior.
void set_should_launch_browser(bool value) { should_launch_browser_ = value; }
// Sets the list of default policy switches to be added to command line on the // Sets the list of default policy switches to be added to command line on the
// login screen. // login screen.
void SetDefaultLoginSwitches( void SetDefaultLoginSwitches(
...@@ -96,6 +101,10 @@ class LoginManagerMixin : public InProcessBrowserTestMixin { ...@@ -96,6 +101,10 @@ class LoginManagerMixin : public InProcessBrowserTestMixin {
bool session_restore_enabled_ = false; bool session_restore_enabled_ = false;
test::SessionFlagsManager session_flags_manager_; test::SessionFlagsManager session_flags_manager_;
// Whether the user session manager should skip browser launch steps for
// testing.
bool should_launch_browser_ = false;
DISALLOW_COPY_AND_ASSIGN(LoginManagerMixin); DISALLOW_COPY_AND_ASSIGN(LoginManagerMixin);
}; };
......
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