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

Reset screen browser tests now work with views login

This updates reset_browsertests to use views based login instead of
deprecated web UI login. Portion of the tests check that reset screen is
shown on restart if local state suggests that reset was requested in the
previous session - web UI account picker UI is not expected to show up
in that scenario, so there is no value in testing it.

BUG=944345

Change-Id: I3953472130878b048ea5b86caaafb1962e1bef96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553874
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648339}
parent b24cc9df
......@@ -79,7 +79,9 @@ void LoginManagerTest::TearDownOnMainThread() {
}
void LoginManagerTest::SetUpCommandLine(base::CommandLine* command_line) {
command_line->AppendSwitch(ash::switches::kShowWebUiLogin);
if (force_webui_login_) {
command_line->AppendSwitch(ash::switches::kShowWebUiLogin);
}
command_line->AppendSwitch(chromeos::switches::kLoginManager);
command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
......
......@@ -58,7 +58,12 @@ class LoginManagerTest : public MixinBasedInProcessBrowserTest {
// Add user with |user_id| to session.
void AddUser(const AccountId& user_id);
void set_force_webui_login(bool force) { force_webui_login_ = force; }
private:
// If set, the tests will use deprecated webui login.
// TODO(tbarzic): Migrate all tests to work with views login implementation.
bool force_webui_login_ = true;
const bool should_launch_browser_;
const bool should_initialize_webui_;
......
......@@ -153,6 +153,17 @@ std::unique_ptr<TestConditionWaiter> JSChecker::CreateEnabledWaiter(
return CreateWaiter(js_condition);
}
std::unique_ptr<TestConditionWaiter> JSChecker::CreateHasClassWaiter(
bool has_class,
const std::string& css_class,
std::initializer_list<base::StringPiece> element_ids) {
std::string js_condition = ElementHasClassCondition(css_class, element_ids);
if (!has_class) {
js_condition = "!(" + js_condition + ")";
}
return CreateWaiter(js_condition);
}
void JSChecker::GetBoolImpl(const std::string& expression, bool* result) {
CHECK(web_contents_);
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
......
......@@ -76,6 +76,13 @@ class JSChecker {
bool enabled,
std::initializer_list<base::StringPiece> element_ids);
// Waiter that waits until the specified element's class list contains, or
// doesn't contain the specified class.
std::unique_ptr<TestConditionWaiter> CreateHasClassWaiter(
bool has_class,
const std::string& css_class,
std::initializer_list<base::StringPiece> element_ids);
// Expects that indicated UI element is not hidden.
// NOTE: This only checks hidden property - it might not work for elements
// hidden by "display: none" style.
......
......@@ -18,7 +18,7 @@ OobeScreenExitWaiter::~OobeScreenExitWaiter() = default;
void OobeScreenExitWaiter::Wait() {
DCHECK_EQ(State::IDLE, state_);
if (GetOobeUI()->current_screen() == target_screen_) {
if (GetOobeUI()->current_screen() != target_screen_) {
state_ = State::DONE;
return;
}
......@@ -40,7 +40,6 @@ void OobeScreenExitWaiter::Wait() {
void OobeScreenExitWaiter::OnCurrentScreenChanged(OobeScreen current_screen,
OobeScreen new_screen) {
DCHECK_NE(state_, State::IDLE);
if (new_screen != target_screen_)
EndWait();
}
......
......@@ -1220,19 +1220,6 @@ void SigninScreenHandler::HandleAccountPickerReady() {
return;
}
PrefService* prefs = g_browser_process->local_state();
if (prefs->GetBoolean(prefs::kFactoryResetRequested)) {
if (core_oobe_view_)
core_oobe_view_->ShowDeviceResetScreen();
return;
} else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) {
if (core_oobe_view_)
core_oobe_view_->ShowEnableDebuggingScreen();
return;
}
is_account_picker_showing_first_time_ = true;
// The wallpaper may have been set before the instance is initialized, so make
......
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