Commit 88bbb61e authored by Thomas Tellier's avatar Thomas Tellier Committed by Commit Bot

Add disable by default feature flag for login display password button

This CL reintroduces the submit button on the login / lock screen password textfield and disable the login display password button feature by default, by putting it under a feature flag.

Bug: 1090319
Change-Id: I521a19262726f7c0566d824b0efe5aa1c9abb7a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247826
Commit-Queue: Thomas Tellier <tellier@google.com>
Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780311}
parent 09029034
......@@ -35,6 +35,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/user_manager/user.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
......@@ -824,14 +825,26 @@ LoginAuthUserView::LoginAuthUserView(const LoginUserInfo& user,
password_view_->SetDisplayPasswordButtonVisible(
user.show_display_password_button);
auto pin_view = std::make_unique<LoginPinView>(
LoginPinView::Style::kAlphanumeric,
base::BindRepeating(&LoginPasswordView::InsertNumber,
base::Unretained(password_view.get())),
base::BindRepeating(&LoginPasswordView::Backspace,
base::Unretained(password_view.get())),
base::BindRepeating(&LoginPasswordView::SubmitPassword,
base::Unretained(password_view.get())));
std::unique_ptr<LoginPinView> pin_view;
// If the display password button feature is disabled, the PIN view does not
// need a submit button as the password view already has one.
if (chromeos::features::IsLoginDisplayPasswordButtonEnabled()) {
pin_view = std::make_unique<LoginPinView>(
LoginPinView::Style::kAlphanumeric,
base::BindRepeating(&LoginPasswordView::InsertNumber,
base::Unretained(password_view.get())),
base::BindRepeating(&LoginPasswordView::Backspace,
base::Unretained(password_view.get())),
base::BindRepeating(&LoginPasswordView::SubmitPassword,
base::Unretained(password_view.get())));
} else {
pin_view = std::make_unique<LoginPinView>(
LoginPinView::Style::kAlphanumeric,
base::BindRepeating(&LoginPasswordView::InsertNumber,
base::Unretained(password_view.get())),
base::BindRepeating(&LoginPasswordView::Backspace,
base::Unretained(password_view.get())));
}
pin_view_ = pin_view.get();
DCHECK(pin_view_->layer());
......@@ -985,7 +998,7 @@ void LoginAuthUserView::SetAuthMethods(uint32_t auth_methods,
password_view_->SetEnabled(has_password);
password_view_->SetEnabledOnEmptyPassword(has_tap);
password_view_->SetFocusEnabledOnTextfield(has_password);
password_view_->SetFocusEnabledForChildViews(has_password);
password_view_->SetVisible(!hide_auth && has_password);
password_view_->layer()->SetOpacity(has_password ? 1 : 0);
password_view_container_->SetVisible(has_password || !has_challenge_response);
......
......@@ -12,6 +12,8 @@
#include "base/bind_helpers.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/dbus/power/fake_power_manager_client.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/event_utils.h"
......@@ -198,6 +200,39 @@ TEST_F(LoginAuthUserViewUnittest, PasswordFieldChangeOnUpdateUser) {
view_->UpdateForUser(user_);
EXPECT_EQ(password_test.textfield()->GetText(), password);
auto another_user = CreateUser("user2@domain.com");
view_->UpdateForUser(another_user);
EXPECT_TRUE(password_test.textfield()->GetText().empty());
}
// LoginAuthUserViewUnittest with display password button feature enabled.
class LoginAuthUserViewUnittestFeatureEnabled
: public LoginAuthUserViewUnittest {
protected:
LoginAuthUserViewUnittestFeatureEnabled() {
feature_list_.InitWithFeatures(
{chromeos::features::kLoginDisplayPasswordButton}, {});
}
LoginAuthUserViewUnittestFeatureEnabled(
const LoginAuthUserViewUnittestFeatureEnabled&) = delete;
LoginAuthUserViewUnittestFeatureEnabled& operator=(
const LoginAuthUserViewUnittestFeatureEnabled&) = delete;
~LoginAuthUserViewUnittestFeatureEnabled() override = default;
private:
base::test::ScopedFeatureList feature_list_;
};
TEST_F(LoginAuthUserViewUnittestFeatureEnabled,
PasswordFieldChangeOnUpdateUser) {
LoginAuthUserView::TestApi test_auth_user_view(view_);
LoginPasswordView::TestApi password_test(test_auth_user_view.password_view());
const auto password = base::ASCIIToUTF16("abc1");
password_test.textfield()->SetText(password);
view_->UpdateForUser(user_);
EXPECT_EQ(password_test.textfield()->GetText(), password);
auto another_user = CreateUser("user2@domain.com");
view_->UpdateForUser(another_user);
EXPECT_TRUE(password_test.textfield()->GetText().empty());
......
......@@ -8,6 +8,7 @@
#include "ash/login/ui/horizontal_image_sequence_animation_decoder.h"
#include "ash/login/ui/hover_notifier.h"
#include "ash/login/ui/lock_screen.h"
#include "ash/login/ui/login_button.h"
#include "ash/login/ui/non_accessible_view.h"
#include "ash/public/cpp/login_constants.h"
#include "ash/public/cpp/login_types.h"
......@@ -19,6 +20,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -64,6 +66,9 @@ constexpr int kPasswordFontDeltaSize = 5;
// Spacing between glyphs.
constexpr int kPasswordGlyphSpacing = 6;
// Size (width/height) of the submit button.
constexpr int kSubmitButtonSizeDp = 20;
// Size (width/height) of the display password button.
constexpr int kDisplayPasswordButtonSizeDp = 20;
......@@ -418,6 +423,7 @@ LoginPasswordView::TestApi::~TestApi() = default;
void LoginPasswordView::TestApi::SubmitPassword(const std::string& password) {
view_->textfield_->SetText(base::ASCIIToUTF16(password));
view_->UpdateUiState();
view_->SubmitPassword();
}
......@@ -425,6 +431,10 @@ views::Textfield* LoginPasswordView::TestApi::textfield() const {
return view_->textfield_;
}
views::View* LoginPasswordView::TestApi::submit_button() const {
return view_->submit_button_;
}
views::ToggleImageButton* LoginPasswordView::TestApi::display_password_button()
const {
return view_->display_password_button_;
......@@ -448,7 +458,9 @@ void LoginPasswordView::TestApi::SetTimers(
}
LoginPasswordView::LoginPasswordView()
: clear_password_timer_(std::make_unique<base::RetainingOneShotTimer>()),
: is_display_password_feature_enabled_(
chromeos::features::IsLoginDisplayPasswordButtonEnabled()),
clear_password_timer_(std::make_unique<base::RetainingOneShotTimer>()),
hide_password_timer_(std::make_unique<base::RetainingOneShotTimer>()) {
Shell::Get()->ime_controller()->AddObserver(this);
......@@ -504,9 +516,27 @@ LoginPasswordView::LoginPasswordView()
// OnCapsLockChanged with the actual caps lock state.
capslock_icon_->SetVisible(false);
// Display password button.
display_password_button_ = password_row_->AddChildView(
std::make_unique<DisplayPasswordButton>(this));
if (is_display_password_feature_enabled_) {
// Display password button.
display_password_button_ = password_row_->AddChildView(
std::make_unique<DisplayPasswordButton>(this));
} else {
// Submit button.
submit_button_ =
password_row_->AddChildView(std::make_unique<LoginButton>(this));
submit_button_->SetImage(
views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(kLockScreenArrowIcon, kSubmitButtonSizeDp,
login_constants::kButtonEnabledColor));
submit_button_->SetImage(
views::Button::STATE_DISABLED,
gfx::CreateVectorIcon(
kLockScreenArrowIcon, kSubmitButtonSizeDp,
SkColorSetA(login_constants::kButtonEnabledColor,
login_constants::kButtonDisabledAlpha)));
submit_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_SUBMIT_BUTTON_ACCESSIBLE_NAME));
}
// Separator on bottom.
separator_ = AddChildView(std::make_unique<NonAccessibleSeparator>());
......@@ -519,6 +549,9 @@ LoginPasswordView::LoginPasswordView()
// Initialize with the initial state of caps lock.
OnCapsLockChanged(Shell::Get()->ime_controller()->IsCapsLockEnabled());
// Make sure the UI start with the correct states.
UpdateUiState();
}
LoginPasswordView::~LoginPasswordView() {
......@@ -540,6 +573,7 @@ void LoginPasswordView::Init(
void LoginPasswordView::SetEnabledOnEmptyPassword(bool enabled) {
enabled_on_empty_password_ = enabled;
UpdateUiState();
}
void LoginPasswordView::SetEasyUnlockIcon(
......@@ -559,14 +593,16 @@ void LoginPasswordView::SetAccessibleName(const base::string16& name) {
textfield_->SetAccessibleName(name);
}
void LoginPasswordView::SetFocusEnabledOnTextfield(bool enable) {
void LoginPasswordView::SetFocusEnabledForChildViews(bool enable) {
auto behavior = enable ? FocusBehavior::ALWAYS : FocusBehavior::NEVER;
textfield_->SetFocusBehavior(behavior);
}
void LoginPasswordView::SetDisplayPasswordButtonVisible(bool visible) {
if (!is_display_password_feature_enabled_)
return;
display_password_button_->SetVisible(visible);
// Only start the timer if the display password feature is enabled.
// Only start the timer if the display password button is enabled.
if (visible) {
clear_password_timer_->Start(
FROM_HERE, kClearPasswordAfterDelay,
......@@ -576,9 +612,12 @@ void LoginPasswordView::SetDisplayPasswordButtonVisible(bool visible) {
void LoginPasswordView::Reset() {
Clear();
// A user could hit the display button, then quickly switch account and
// type; we want the password to be hidden in such a case.
HidePassword(false /*chromevox_exception*/);
if (is_display_password_feature_enabled_) {
// A user could hit the display button, then quickly switch account and
// type; we want the password to be hidden in such a case.
HidePassword(false /*chromevox_exception*/);
}
}
void LoginPasswordView::Clear() {
......@@ -620,6 +659,7 @@ void LoginPasswordView::SetPlaceholderText(
void LoginPasswordView::SetReadOnly(bool read_only) {
textfield_->SetReadOnly(read_only);
textfield_->SetCursorEnabled(!read_only);
UpdateUiState();
}
const char* LoginPasswordView::GetClassName() const {
......@@ -658,8 +698,13 @@ void LoginPasswordView::InvertPasswordDisplayingState() {
void LoginPasswordView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK_EQ(sender, display_password_button_);
InvertPasswordDisplayingState();
if (is_display_password_feature_enabled_) {
DCHECK_EQ(sender, display_password_button_);
InvertPasswordDisplayingState();
} else {
DCHECK_EQ(sender, submit_button_);
SubmitPassword();
}
}
void LoginPasswordView::HidePassword(bool chromevox_exception) {
......@@ -674,7 +719,12 @@ void LoginPasswordView::HidePassword(bool chromevox_exception) {
void LoginPasswordView::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
DCHECK_EQ(sender, textfield_);
UpdateUiState();
on_password_text_changed_.Run(new_contents.empty() /*is_empty*/);
if (!is_display_password_feature_enabled_)
return;
// Only reset the timer if the display password feature is enabled.
if (display_password_button_->GetVisible())
clear_password_timer_->Reset();
......@@ -710,6 +760,11 @@ bool LoginPasswordView::HandleKeyEvent(views::Textfield* sender,
return true;
}
void LoginPasswordView::UpdateUiState() {
if (!is_display_password_feature_enabled_)
submit_button_->SetEnabled(IsPasswordSubmittable());
}
void LoginPasswordView::OnCapsLockChanged(bool enabled) {
capslock_icon_->SetVisible(enabled);
password_row_->Layout();
......
......@@ -26,14 +26,24 @@ class ToggleImageButton;
} // namespace views
namespace ash {
class LoginButton;
enum class EasyUnlockIconId;
// Contains a textfield instance with a display password button. The user can
// type a password into the textfield and hit enter to submit.
// Contains a textfield instance with a submit button when the display password
// button feature is disabled, and a display password button otherwise. The user
// can type a password into the textfield and hit enter to submit.
//
// This view is always rendered via layers.
//
// The password view looks like this by default:
//
// When the display password button feature is disabled, the password view looks
// like this:
//
// * * * * * * =>
// ------------------
//
// When the display password button feature is enabled, the password view looks
// like this by default:
//
// * * * * * * (\)
// ------------------
......@@ -56,6 +66,7 @@ class ASH_EXPORT LoginPasswordView : public views::View,
void SubmitPassword(const std::string& password);
views::Textfield* textfield() const;
views::View* submit_button() const;
views::ToggleImageButton* display_password_button() const;
views::View* easy_unlock_icon() const;
void set_immediately_hover_easy_unlock_icon();
......@@ -77,7 +88,8 @@ class ASH_EXPORT LoginPasswordView : public views::View,
LoginPasswordView();
~LoginPasswordView() override;
// |on_submit| is called when the user hits enter.
// |on_submit| is called when the user hits enter (or pressed the submit arrow
// when the display password button feature is disabled).
// |on_password_text_changed| is called when the text in the password field
// changes.
void Init(const OnPasswordSubmit& on_submit,
......@@ -95,8 +107,10 @@ class ASH_EXPORT LoginPasswordView : public views::View,
// Set the textfield name used for accessibility.
void SetAccessibleName(const base::string16& name);
// Enable or disable focus on the password field.
void SetFocusEnabledOnTextfield(bool enable);
// Enable or disable focus on the child elements (i.e.: password field, and
// submit button if the display password button feature is disabled, or
// display password button if the feature is enabled).
void SetFocusEnabledForChildViews(bool enable);
// Sets whether the display password button is visible.
void SetDisplayPasswordButtonVisible(bool visible);
......@@ -118,7 +132,8 @@ class ASH_EXPORT LoginPasswordView : public views::View,
// itself because it doesn't know which auth methods are enabled.
void SetPlaceholderText(const base::string16& placeholder_text);
// Makes the textfield read-only.
// Makes the textfield read-only, and enables/disables submitting if the
// display password button feature is disabled.
void SetReadOnly(bool read_only);
// views::View:
......@@ -167,9 +182,17 @@ class ASH_EXPORT LoginPasswordView : public views::View,
// textfield is not empty or if |enabled_on_empty_password| is true.
bool IsPasswordSubmittable();
// When the display password button feature is disabled, UpdateUiState
// enables/disables the submit button and changes the color of the separator
// based on if the view is enabled.
void UpdateUiState();
OnPasswordSubmit on_submit_;
OnPasswordTextChanged on_password_text_changed_;
// True if the display password button feature is enabled.
const bool is_display_password_feature_enabled_;
// Is the password field enabled when there is no text?
bool enabled_on_empty_password_ = false;
......@@ -185,6 +208,7 @@ class ASH_EXPORT LoginPasswordView : public views::View,
views::View* password_row_ = nullptr;
LoginTextfield* textfield_ = nullptr;
LoginButton* submit_button_ = nullptr;
DisplayPasswordButton* display_password_button_ = nullptr;
views::ImageView* capslock_icon_ = nullptr;
views::Separator* separator_ = nullptr;
......
......@@ -9,7 +9,9 @@
#include "ash/shell.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/timer/mock_timer.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/controls/button/image_button.h"
......@@ -62,10 +64,64 @@ class LoginPasswordViewTest : public LoginTestBase {
DISALLOW_COPY_AND_ASSIGN(LoginPasswordViewTest);
};
// LoginPasswordViewTest with display password button feature enabled.
class LoginPasswordViewTestFeatureEnabled : public LoginPasswordViewTest {
protected:
LoginPasswordViewTestFeatureEnabled() {
feature_list_.InitWithFeatures(
{chromeos::features::kLoginDisplayPasswordButton}, {});
}
LoginPasswordViewTestFeatureEnabled(
const LoginPasswordViewTestFeatureEnabled&) = delete;
LoginPasswordViewTestFeatureEnabled& operator=(
const LoginPasswordViewTestFeatureEnabled&) = delete;
~LoginPasswordViewTestFeatureEnabled() override = default;
private:
base::test::ScopedFeatureList feature_list_;
};
} // namespace
// Verifies that the submit button updates its UI state.
TEST_F(LoginPasswordViewTest, SubmitButtonUpdatesUiState) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
// The submit button starts with the disabled state.
EXPECT_TRUE(is_password_field_empty_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Enter 'a'. The submit button is enabled.
generator->PressKey(ui::KeyboardCode::VKEY_A, 0);
EXPECT_FALSE(is_password_field_empty_);
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
// Enter 'b'. The submit button stays enabled.
generator->PressKey(ui::KeyboardCode::VKEY_B, 0);
EXPECT_FALSE(is_password_field_empty_);
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
// Clear password. The submit button is disabled.
view_->Clear();
EXPECT_TRUE(is_password_field_empty_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Enter 'a'. The submit button is enabled.
generator->PressKey(ui::KeyboardCode::VKEY_A, 0);
EXPECT_FALSE(is_password_field_empty_);
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
// Set the text field to be read-only. The submit button is disabled.
view_->SetReadOnly(true);
EXPECT_FALSE(is_password_field_empty_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Set the text field to be not read-only. The submit button is enabled.
view_->SetReadOnly(false);
EXPECT_FALSE(is_password_field_empty_);
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
}
// Verifies that the display password button updates its UI state.
TEST_F(LoginPasswordViewTest, DisplayPasswordButtonUpdatesUiState) {
TEST_F(LoginPasswordViewTestFeatureEnabled,
DisplayPasswordButtonUpdatesUiState) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
......@@ -116,6 +172,23 @@ TEST_F(LoginPasswordViewTest, PasswordSubmitIncludesPasswordText) {
EXPECT_EQ(base::ASCIIToUTF16("abc1"), *password_);
}
// Verifies that password submit works when clicking the submit button.
TEST_F(LoginPasswordViewTest, PasswordSubmitViaButton) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_A, 0);
generator->PressKey(ui::KeyboardCode::VKEY_B, 0);
generator->PressKey(ui::KeyboardCode::VKEY_C, 0);
generator->PressKey(ui::KeyboardCode::VKEY_1, 0);
generator->MoveMouseTo(
test_api.submit_button()->GetBoundsInScreen().CenterPoint());
generator->ClickLeftButton();
ASSERT_TRUE(password_.has_value());
EXPECT_EQ(base::ASCIIToUTF16("abc1"), *password_);
}
// Verifies that text is not cleared after submitting a password.
TEST_F(LoginPasswordViewTest, PasswordSubmitClearsPassword) {
LoginPasswordView::TestApi test_api(view_);
......@@ -211,7 +284,7 @@ TEST_F(LoginPasswordViewTest, CtrlZDisabled) {
// Verifies that the password textfield clears after a delay when the display
// password button is shown.
TEST_F(LoginPasswordViewTest, PasswordAutoClearsAndHides) {
TEST_F(LoginPasswordViewTestFeatureEnabled, PasswordAutoClearsAndHides) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
......@@ -254,7 +327,7 @@ TEST_F(LoginPasswordViewTest, PasswordAutoClearsAndHides) {
}
// Verifies that the password textfield hides back when the content changes.
TEST_F(LoginPasswordViewTest, PasswordHidesAfterTyping) {
TEST_F(LoginPasswordViewTestFeatureEnabled, PasswordHidesAfterTyping) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
......@@ -286,7 +359,7 @@ TEST_F(LoginPasswordViewTest, PasswordHidesAfterTyping) {
// Checks that the display password button is disabled when the textfield is
// empty and enabled when it is not.
TEST_F(LoginPasswordViewTest,
TEST_F(LoginPasswordViewTestFeatureEnabled,
DisplayPasswordButonIsEnabledIFFTextfieldIsNotEmpty) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
......@@ -318,7 +391,7 @@ TEST_F(LoginPasswordViewTest,
}
// Verifies that focus returned to the textfield after InsertNumber is called.
TEST_F(LoginPasswordViewTest, FocusReturn) {
TEST_F(LoginPasswordViewTestFeatureEnabled, FocusReturn) {
LoginPasswordView::TestApi test_api(view_);
ui::test::EventGenerator* generator = GetEventGenerator();
// Verify that focus is returned to view after the number insertion.
......
......@@ -474,6 +474,14 @@ LoginPinView::LoginPinView(Style keyboard_style,
row->AddChildView(submit_button_);
}
LoginPinView::LoginPinView(Style keyboard_style,
const OnPinKey& on_key,
const OnPinBackspace& on_backspace)
: LoginPinView(keyboard_style,
on_key,
on_backspace,
base::RepeatingClosure()) {}
LoginPinView::~LoginPinView() = default;
void LoginPinView::NotifyAccessibilityLocationChanged() {
......
......@@ -91,12 +91,19 @@ class ASH_EXPORT LoginPinView : public NonAccessibleView {
// non-null.
// |on_backspace| is called when the user wants to erase the most recently
// tapped key; must be non-null.
// |on_submit| is called when the user wants to submit the PIN / password;
// pass null in order to hide the submit button.
// |on_submit| is called when the user wants to submit the PIN / password.
LoginPinView(Style keyboard_style,
const OnPinKey& on_key,
const OnPinBackspace& on_backspace,
const OnPinSubmit& on_submit);
// Creates PIN view without submit button. This is useful when a submit button
// is already present in the password view, which is the case when the display
// password button feature is disabled.
LoginPinView(Style keyboard_style,
const OnPinKey& on_key,
const OnPinBackspace& on_backspace);
~LoginPinView() override;
// Notify accessibility that location of rows and LoginPinView changed.
......
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "ash/public/cpp/login_screen_test_api.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
......@@ -22,6 +23,7 @@
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h"
#include "chrome/common/pref_names.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/known_user.h"
......@@ -165,7 +167,10 @@ IN_PROC_BROWSER_TEST_F(LoginUIEnrolledTest, UserReverseRemoval) {
class DisplayPasswordButtonTest : public LoginManagerTest {
public:
DisplayPasswordButtonTest() : LoginManagerTest() {}
DisplayPasswordButtonTest() : LoginManagerTest() {
feature_list_.InitWithFeatures(
{chromeos::features::kLoginDisplayPasswordButton}, {});
}
void LoginAndLock(const LoginManagerMixin::TestUserInfo& test_user) {
chromeos::WizardController::SkipPostLoginScreensForTesting();
......@@ -213,6 +218,9 @@ class DisplayPasswordButtonTest : public LoginManagerTest {
AccountId::FromUserEmailGaiaId("user@example.com", "22222")};
UserPolicyMixin user_policy_mixin_{&mixin_host_, managed_user_.account_id};
LoginManagerMixin login_manager_mixin_{&mixin_host_};
private:
base::test::ScopedFeatureList feature_list_;
};
// Check if the display password button is shown on the lock screen after having
......
......@@ -253,6 +253,10 @@ const base::Feature kInstantTethering{"InstantTethering",
const base::Feature kLacrosSupport{"LacrosSupport",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables or disables the display password button on login / lock screen.
const base::Feature kLoginDisplayPasswordButton{
"LoginDisplayPasswordButton", base::FEATURE_DISABLED_BY_DEFAULT};
// ChromeOS Media App. https://crbug.com/996088.
const base::Feature kMediaApp{"MediaApp", base::FEATURE_ENABLED_BY_DEFAULT};
......@@ -459,6 +463,10 @@ bool IsLacrosSupportEnabled() {
return base::FeatureList::IsEnabled(kLacrosSupport);
}
bool IsLoginDisplayPasswordButtonEnabled() {
return base::FeatureList::IsEnabled(kLoginDisplayPasswordButton);
}
bool IsOobeScreensPriorityEnabled() {
return base::FeatureList::IsEnabled(kOobeScreensPriority);
}
......
......@@ -113,6 +113,8 @@ extern const base::Feature kVirtualKeyboardFloatingDefault;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kInstantTethering;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kLacrosSupport;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kLoginDisplayPasswordButton;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kMediaApp;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kNativeRuleBasedTyping;
......@@ -196,6 +198,7 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsImeSandboxEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsInstantTetheringBackgroundAdvertisingSupported();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsLacrosSupportEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsLoginDisplayPasswordButtonEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsOobeScreensPriorityEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsParentalControlsSettingsEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsQuickAnswersDogfood();
......
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