Commit 0706f607 authored by Yann Dago's avatar Yann Dago Committed by Chromium LUCI CQ

Update enterprise confirmation UI

Change the title enterprise confirmation dialog. Remove the "Link Data"
button. Change the "Create New Profile" label for "Add Work Profile".
Add a default button style. Update the general wording of the enterprise
notice.

Screenshot After: http://screen/AnT3LURCFbXEQmr
Screenshot Before : http://screen/5GcNmNjEVtjpvdQ

Bug: 1148173
Change-Id: Ief01580cd50d8951ef82a94a6549552fd3aa0bd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521055
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarCaitlin Fischer <caitlinfischer@google.com>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832676}
parent d7d6986e
...@@ -695,6 +695,18 @@ Chromium is unable to recover your settings. ...@@ -695,6 +695,18 @@ Chromium is unable to recover your settings.
<message name="IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. Additionally notifies the user that they can create a new profile instead. This message is followed by a 'Learn more' link."> <message name="IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. Additionally notifies the user that they can create a new profile instead. This message is followed by a 'Learn more' link.">
You are signing in with a managed account and giving its administrator control over your Chromium profile. Your Chromium data, such as your apps, bookmarks, history, passwords, and other settings will become permanently tied to <ph name="USER_NAME">$1<ex>pat@example.com</ex></ph>. You will be able to delete this data via the Google Accounts Dashboard, but you will not be able to associate this data with another account. You can optionally create a new profile to keep your existing Chromium data separate. <ph name="LEARN_MORE">$2<ex>Learn more</ex></ph> You are signing in with a managed account and giving its administrator control over your Chromium profile. Your Chromium data, such as your apps, bookmarks, history, passwords, and other settings will become permanently tied to <ph name="USER_NAME">$1<ex>pat@example.com</ex></ph>. You will be able to delete this data via the Google Accounts Dashboard, but you will not be able to associate this data with another account. You can optionally create a new profile to keep your existing Chromium data separate. <ph name="LEARN_MORE">$2<ex>Learn more</ex></ph>
</message> </message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_TITLE" desc="The title of the dialog to confirm adding a new work profile with the signed-in enterprise account">
Add Work Profile to this browser
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. This message is followed by a 'Learn more' link.">
You are adding a work profile to this browser and giving your administrator control over just the work profile.
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_ISOLATION_NOTICE" desc="Notice that work profiles are separated from any personal profile">
This work profile is completely separate from your personal profile.
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_EXPLANATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. This message is followed by a 'Learn more' link.">
Any Chromium data that is generated during the use of this profile (such as the creation of bookmarks, history, passwords, and other settings) can be removed by the work profile administrator. <ph name="LEARN_MORE">$1<ex>Learn more</ex></ph>
</message>
</if> </if>
<!-- about:browser-switch strings --> <!-- about:browser-switch strings -->
......
71c8aeff18ba65c4d376e9a462e1c4d4674f1702
\ No newline at end of file
71c8aeff18ba65c4d376e9a462e1c4d4674f1702
\ No newline at end of file
71c8aeff18ba65c4d376e9a462e1c4d4674f1702
\ No newline at end of file
71c8aeff18ba65c4d376e9a462e1c4d4674f1702
\ No newline at end of file
...@@ -7529,6 +7529,9 @@ the Bookmarks menu."> ...@@ -7529,6 +7529,9 @@ the Bookmarks menu.">
<message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE" desc="Text of the button to create a new profile after enterprise account sign-in"> <message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE" desc="Text of the button to create a new profile after enterprise account sign-in">
Create a New Profile Create a New Profile
</message> </message>
<message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_WORK_PROFILE" desc="Text of the button to create a new work profile after enterprise account sign-in">
Add Work Profile
</message>
<message name="IDS_ENTERPRISE_SIGNIN_CONTINUE" desc="Text of the button to link the current profile with the signed-in enterprise account"> <message name="IDS_ENTERPRISE_SIGNIN_CONTINUE" desc="Text of the button to link the current profile with the signed-in enterprise account">
Link Data Link Data
</message> </message>
...@@ -7537,6 +7540,9 @@ the Bookmarks menu."> ...@@ -7537,6 +7540,9 @@ the Bookmarks menu.">
<message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE" desc="Text of the button to create a new profile after enterprise account sign-in"> <message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE" desc="Text of the button to create a new profile after enterprise account sign-in">
Create a new profile Create a new profile
</message> </message>
<message name="IDS_ENTERPRISE_SIGNIN_CREATE_NEW_WORK_PROFILE" desc="Text of the button to create a new work profile after enterprise account sign-in">
Add work profile
</message>
<message name="IDS_ENTERPRISE_SIGNIN_CONTINUE" desc="Text of the button to link the current profile with the signed-in enterprise account"> <message name="IDS_ENTERPRISE_SIGNIN_CONTINUE" desc="Text of the button to link the current profile with the signed-in enterprise account">
Link data Link data
</message> </message>
......
cfca689b4efef6973e4a4a1948d6e79f3fc0e1ad
\ No newline at end of file
...@@ -702,6 +702,18 @@ Google Chrome is unable to recover your settings. ...@@ -702,6 +702,18 @@ Google Chrome is unable to recover your settings.
<message name="IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. Additionally notifies the user that they can create a new profile instead. This message is followed by a 'Learn more' link."> <message name="IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. Additionally notifies the user that they can create a new profile instead. This message is followed by a 'Learn more' link.">
You are signing in with a managed account and giving its administrator control over your Google Chrome profile. Your Chrome data, such as your apps, bookmarks, history, passwords, and other settings will become permanently tied to <ph name="USER_NAME">$1<ex>pat@example.com</ex></ph>. You will be able to delete this data via the Google Accounts Dashboard, but you will not be able to associate this data with another account. You can optionally create a new profile to keep your existing Chrome data separate. <ph name="LEARN_MORE">$2<ex>Learn more</ex></ph> You are signing in with a managed account and giving its administrator control over your Google Chrome profile. Your Chrome data, such as your apps, bookmarks, history, passwords, and other settings will become permanently tied to <ph name="USER_NAME">$1<ex>pat@example.com</ex></ph>. You will be able to delete this data via the Google Accounts Dashboard, but you will not be able to associate this data with another account. You can optionally create a new profile to keep your existing Chrome data separate. <ph name="LEARN_MORE">$2<ex>Learn more</ex></ph>
</message> </message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_TITLE" desc="The title of the dialog to confirm adding a new work profile with the signed-in enterprise account">
Add Work Profile to this browser
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_CREATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. This message is followed by a 'Learn more' link.">
You are adding a work profile to this browser and giving your administrator control over just the work profile.
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_ISOLATION_NOTICE" desc="Notice that work profiles are separated from any personal profile">
This work profile is completely separate from your personal profile.
</message>
<message name="IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_EXPLANATION" desc="The warning message displayed to an enterprise user about to link their profile to their Google account. This message is followed by a 'Learn more' link.">
Any Chrome data that is generated during the use of this profile (such as the creation of bookmarks, history, passwords, and other settings) can be removed by the work profile administrator. <ph name="LEARN_MORE">$1<ex>Learn more</ex></ph>
</message>
</if> </if>
<!-- about:browser-switch strings --> <!-- about:browser-switch strings -->
......
cfca689b4efef6973e4a4a1948d6e79f3fc0e1ad
\ No newline at end of file
cfca689b4efef6973e4a4a1948d6e79f3fc0e1ad
\ No newline at end of file
cfca689b4efef6973e4a4a1948d6e79f3fc0e1ad
\ No newline at end of file
cfca689b4efef6973e4a4a1948d6e79f3fc0e1ad
\ No newline at end of file
...@@ -58,9 +58,13 @@ const base::Feature kScrollableTabStrip{"ScrollableTabStrip", ...@@ -58,9 +58,13 @@ const base::Feature kScrollableTabStrip{"ScrollableTabStrip",
const base::Feature kScrollableTabStripButtons{ const base::Feature kScrollableTabStripButtons{
"ScrollableTabStripButtons", base::FEATURE_DISABLED_BY_DEFAULT}; "ScrollableTabStripButtons", base::FEATURE_DISABLED_BY_DEFAULT};
// Hosts some content in a side panel. https://crbug.com/1141224 // Hosts some content in a side panel. https://crbug.com/1149995
const base::Feature kSidePanel{"SidePanel", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSidePanel{"SidePanel", base::FEATURE_DISABLED_BY_DEFAULT};
// Updated managed profile sign-in popup. https://crbug.com/1141224
const base::Feature kSyncConfirmationUpdatedText{
"SyncConfirmationUpdatedText", base::FEATURE_DISABLED_BY_DEFAULT};
// Revamp of profiles. https://crbug.com/1108289 // Revamp of profiles. https://crbug.com/1108289
const base::Feature kProfilesUIRevamp{"ProfilesUIRevamp", const base::Feature kProfilesUIRevamp{"ProfilesUIRevamp",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -44,6 +44,8 @@ extern const base::Feature kScrollableTabStripButtons; ...@@ -44,6 +44,8 @@ extern const base::Feature kScrollableTabStripButtons;
extern const base::Feature kSidePanel; extern const base::Feature kSidePanel;
extern const base::Feature kSyncConfirmationUpdatedText;
extern const base::Feature kProfilesUIRevamp; extern const base::Feature kProfilesUIRevamp;
extern const base::Feature kTabGroupsAutoCreate; extern const base::Feature kTabGroupsAutoCreate;
......
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
#include <algorithm> #include <algorithm>
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/profiles/profile_menu_view.h" #include "chrome/browser/ui/views/profiles/profile_menu_view.h"
...@@ -52,26 +54,44 @@ ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews( ...@@ -52,26 +54,44 @@ ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews(
: browser_(browser), : browser_(browser),
username_(username), username_(username),
delegate_(std::move(delegate)), delegate_(std::move(delegate)),
prompt_for_new_profile_(prompt_for_new_profile) { prompt_for_new_profile_(prompt_for_new_profile),
SetShowCloseButton(false); use_work_profile_wording_(base::FeatureList::IsEnabled(
SetTitle(IDS_ENTERPRISE_SIGNIN_TITLE); features::kSyncConfirmationUpdatedText)) {
SetDefaultButton(ui::DIALOG_BUTTON_NONE); if (use_work_profile_wording_) {
SetButtonLabel( SetTitle(IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_TITLE);
ui::DIALOG_BUTTON_OK, // Create business icon.
l10n_util::GetStringUTF16(prompt_for_new_profile_ int business_icon_size = 20;
? IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE auto business_icon = std::make_unique<views::ImageView>();
: IDS_ENTERPRISE_SIGNIN_CONTINUE)); SetIcon(gfx::CreateVectorIcon(
gfx::IconDescription(vector_icons::kBusinessIcon, business_icon_size,
gfx::kChromeIconGrey)));
SetShowIcon(true);
SetDefaultButton(ui::DIALOG_BUTTON_OK);
SetButtonLabel(ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(
prompt_for_new_profile_
? IDS_ENTERPRISE_SIGNIN_CREATE_NEW_WORK_PROFILE
: IDS_ENTERPRISE_SIGNIN_CONTINUE));
} else {
SetShowCloseButton(false);
SetTitle(IDS_ENTERPRISE_SIGNIN_TITLE);
SetDefaultButton(ui::DIALOG_BUTTON_NONE);
SetButtonLabel(
ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(prompt_for_new_profile_
? IDS_ENTERPRISE_SIGNIN_CREATE_NEW_PROFILE
: IDS_ENTERPRISE_SIGNIN_CONTINUE));
if (prompt_for_new_profile) {
SetExtraView(std::make_unique<views::MdTextButton>(
base::BindRepeating(&ProfileSigninConfirmationDialogViews::
ContinueSigninButtonPressed,
base::Unretained(this)),
l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CONTINUE)));
}
}
SetButtonLabel(ui::DIALOG_BUTTON_CANCEL, SetButtonLabel(ui::DIALOG_BUTTON_CANCEL,
l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CANCEL)); l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CANCEL));
if (prompt_for_new_profile) {
SetExtraView(std::make_unique<views::MdTextButton>(
base::BindRepeating(
&ProfileSigninConfirmationDialogViews::ContinueSigninButtonPressed,
base::Unretained(this)),
l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CONTINUE)));
}
using Delegate = ui::ProfileSigninConfirmationDelegate; using Delegate = ui::ProfileSigninConfirmationDelegate;
using DelegateNotifyFn = void (Delegate::*)(); using DelegateNotifyFn = void (Delegate::*)();
auto notify_delegate = [](ProfileSigninConfirmationDialogViews* dialog, auto notify_delegate = [](ProfileSigninConfirmationDialogViews* dialog,
...@@ -131,6 +151,14 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( ...@@ -131,6 +151,14 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged(
if (!details.is_add || details.child != this) if (!details.is_add || details.child != this)
return; return;
if (use_work_profile_wording_)
BuildWorkProfileView();
else
BuildDefaultView();
}
void ProfileSigninConfirmationDialogViews::BuildDefaultView() {
DCHECK(!use_work_profile_wording_);
const SkColor kPromptBarBackgroundColor = const SkColor kPromptBarBackgroundColor =
ui::GetSigninConfirmationPromptBarColor(GetNativeTheme(), 0x0A); ui::GetSigninConfirmationPromptBarColor(GetNativeTheme(), 0x0A);
...@@ -249,6 +277,88 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( ...@@ -249,6 +277,88 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged(
kPreferredWidth, explanation_label_height); kPreferredWidth, explanation_label_height);
} }
void ProfileSigninConfirmationDialogViews::BuildWorkProfileView() {
DCHECK(use_work_profile_wording_);
// Create the explanation label first row.
auto explanation_first_row = std::make_unique<views::Label>();
explanation_first_row->SetText(
l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_CREATION));
explanation_first_row->SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT);
explanation_first_row->SetMultiLine(true);
auto explanation_second_row = std::make_unique<views::Label>();
explanation_second_row->SetText(l10n_util::GetStringUTF16(
IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_ISOLATION_NOTICE));
explanation_second_row->SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT);
// Create the explanation label.
size_t learn_more_offset;
const base::string16 learn_more_text =
l10n_util::GetStringUTF16(IDS_LEARN_MORE);
const base::string16 signin_explanation_text =
l10n_util::GetStringFUTF16(IDS_ENTERPRISE_SIGNIN_WORK_PROFILE_EXPLANATION,
learn_more_text, &learn_more_offset);
auto explanation_label = std::make_unique<views::StyledLabel>();
explanation_label->SetText(signin_explanation_text);
explanation_label->AddStyleRange(
gfx::Range(learn_more_offset, learn_more_offset + learn_more_text.size()),
views::StyledLabel::RangeStyleInfo::CreateForLink(base::BindRepeating(
&ProfileSigninConfirmationDialogViews::LearnMoreClicked,
base::Unretained(this))));
// Layout the components.
const gfx::Insets content_insets =
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
views::CONTROL, views::TEXT);
// The prompt bar needs to go to the edge of the dialog, so remove horizontal
// insets.
SetBorder(views::CreateEmptyBorder(content_insets.top(), 0,
content_insets.bottom(), 0));
views::GridLayout* dialog_layout =
SetLayoutManager(std::make_unique<views::GridLayout>());
// Use a new column set for the explanation label so we can add padding.
dialog_layout->AddPaddingRow(views::GridLayout::kFixedSize,
content_insets.top());
constexpr int kExplanationColumnSetId = 1;
views::ColumnSet* explanation_columns =
dialog_layout->AddColumnSet(kExplanationColumnSetId);
explanation_columns->AddPaddingColumn(views::GridLayout::kFixedSize,
content_insets.left());
explanation_columns->AddColumn(
views::GridLayout::FILL, views::GridLayout::FILL, 1.0,
views::GridLayout::ColumnSize::kUsePreferred, 0, 0);
explanation_columns->AddPaddingColumn(views::GridLayout::kFixedSize,
content_insets.right());
dialog_layout->StartRow(views::GridLayout::kFixedSize,
kExplanationColumnSetId);
const int kPreferredWidth = 440;
int explanation_first_row_height =
explanation_first_row->GetHeightForWidth(kPreferredWidth);
int explanation_second_row_height =
explanation_second_row->GetHeightForWidth(kPreferredWidth);
int explanation_label_height =
explanation_label->GetHeightForWidth(kPreferredWidth);
dialog_layout->AddView(std::move(explanation_first_row), 1, 1,
views::GridLayout::FILL, views::GridLayout::FILL,
kPreferredWidth, explanation_first_row_height);
dialog_layout->StartRowWithPadding(views::GridLayout::kFixedSize,
kExplanationColumnSetId,
views::GridLayout::kFixedSize, 10);
dialog_layout->AddView(std::move(explanation_second_row), 1, 1,
views::GridLayout::FILL, views::GridLayout::FILL,
kPreferredWidth, explanation_second_row_height);
dialog_layout->StartRowWithPadding(views::GridLayout::kFixedSize,
kExplanationColumnSetId,
views::GridLayout::kFixedSize, 10);
dialog_layout->AddView(std::move(explanation_label), 1, 1,
views::GridLayout::FILL, views::GridLayout::FILL,
kPreferredWidth, explanation_label_height);
}
void ProfileSigninConfirmationDialogViews::ContinueSigninButtonPressed() { void ProfileSigninConfirmationDialogViews::ContinueSigninButtonPressed() {
DCHECK(prompt_for_new_profile_); DCHECK(prompt_for_new_profile_);
if (delegate_) { if (delegate_) {
......
...@@ -50,6 +50,13 @@ class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView { ...@@ -50,6 +50,13 @@ class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView {
// Called when the "learn more" link is clicked. // Called when the "learn more" link is clicked.
void LearnMoreClicked(const ui::Event& event); void LearnMoreClicked(const ui::Event& event);
// Builds the default view for the dialog.
void BuildDefaultView();
// Build the view with the "work profile" wording enabled by
// |features::SyncConfirmationUpdatedText|.
void BuildWorkProfileView();
// Weak ptr to parent view. // Weak ptr to parent view.
Browser* const browser_; Browser* const browser_;
...@@ -62,6 +69,8 @@ class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView { ...@@ -62,6 +69,8 @@ class ProfileSigninConfirmationDialogViews : public views::DialogDelegateView {
// Whether the user should be prompted to create a new profile. // Whether the user should be prompted to create a new profile.
const bool prompt_for_new_profile_; const bool prompt_for_new_profile_;
const bool use_work_profile_wording_;
DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews); DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationDialogViews);
}; };
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h" #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h"
#include "chrome/test/views/chrome_views_test_base.h" #include "chrome/test/views/chrome_views_test_base.h"
#include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button.h"
...@@ -31,9 +33,10 @@ class TestDelegate : public ui::ProfileSigninConfirmationDelegate { ...@@ -31,9 +33,10 @@ class TestDelegate : public ui::ProfileSigninConfirmationDelegate {
class ProfileSigninConfirmationDialogTest : public ChromeViewsTestBase { class ProfileSigninConfirmationDialogTest : public ChromeViewsTestBase {
public: public:
void BuildDialog( void BuildDialog(
std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) { std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate,
bool prompt_for_new_profile = true) {
auto dialog = std::make_unique<ProfileSigninConfirmationDialogViews>( auto dialog = std::make_unique<ProfileSigninConfirmationDialogViews>(
nullptr, "foo@bar.com", std::move(delegate), true); nullptr, "foo@bar.com", std::move(delegate), prompt_for_new_profile);
weak_dialog_ = dialog.get(); weak_dialog_ = dialog.get();
widget_ = views::DialogDelegate::CreateDialogWidget(dialog.release(), widget_ = views::DialogDelegate::CreateDialogWidget(dialog.release(),
...@@ -54,6 +57,7 @@ class ProfileSigninConfirmationDialogTest : public ChromeViewsTestBase { ...@@ -54,6 +57,7 @@ class ProfileSigninConfirmationDialogTest : public ChromeViewsTestBase {
ProfileSigninConfirmationDialogViews* weak_dialog_ = nullptr; ProfileSigninConfirmationDialogViews* weak_dialog_ = nullptr;
views::Widget* widget_ = nullptr; views::Widget* widget_ = nullptr;
base::test::ScopedFeatureList features_;
}; };
// Regression test for https://crbug.com/1054866 // Regression test for https://crbug.com/1054866
...@@ -117,3 +121,85 @@ TEST_F(ProfileSigninConfirmationDialogTest, ...@@ -117,3 +121,85 @@ TEST_F(ProfileSigninConfirmationDialogTest,
EXPECT_EQ(continues, 0); EXPECT_EQ(continues, 0);
EXPECT_EQ(signins, 1); EXPECT_EQ(signins, 1);
} }
// Regression test for https://crbug.com/1091232
TEST_F(ProfileSigninConfirmationDialogTest,
CancelButtonOnlyCallsDelegateOnceProfileVersion) {
features_.InitAndEnableFeature(features::kSyncConfirmationUpdatedText);
int cancels = 0;
int continues = 0;
int signins = 0;
auto delegate =
std::make_unique<TestDelegate>(&cancels, &continues, &signins);
BuildDialog(std::move(delegate));
widget_->Show();
// Press the "Cancel" button.
views::Button* button = weak_dialog_->GetCancelButton();
PressButton(button);
EXPECT_EQ(cancels, 1);
EXPECT_EQ(continues, 0);
EXPECT_EQ(signins, 0);
}
TEST_F(ProfileSigninConfirmationDialogTest,
NewProfileButtonOnlyCallsDelegateOnceWorkProfileVersion) {
features_.InitAndEnableFeature(features::kSyncConfirmationUpdatedText);
int cancels = 0;
int continues = 0;
int signins = 0;
auto delegate =
std::make_unique<TestDelegate>(&cancels, &continues, &signins);
BuildDialog(std::move(delegate));
widget_->Show();
// Press the "Signin with new profile" button.
views::Button* button = weak_dialog_->GetOkButton();
PressButton(button);
EXPECT_EQ(cancels, 0);
EXPECT_EQ(continues, 0);
EXPECT_EQ(signins, 1);
}
TEST_F(ProfileSigninConfirmationDialogTest,
OKButtonContinuesForFreshWorkProfileVersion) {
features_.InitAndEnableFeature(features::kSyncConfirmationUpdatedText);
int cancels = 0;
int continues = 0;
int signins = 0;
auto delegate =
std::make_unique<TestDelegate>(&cancels, &continues, &signins);
BuildDialog(std::move(delegate), /*prompt_for_new_profile=*/false);
widget_->Show();
// Press the "Signin with new profile" button.
views::Button* button = weak_dialog_->GetOkButton();
PressButton(button);
EXPECT_EQ(cancels, 0);
EXPECT_EQ(continues, 1);
EXPECT_EQ(signins, 0);
}
TEST_F(ProfileSigninConfirmationDialogTest, NoExtraViewWorkProfileVersion) {
features_.InitAndEnableFeature(features::kSyncConfirmationUpdatedText);
int cancels = 0;
int continues = 0;
int signins = 0;
auto delegate =
std::make_unique<TestDelegate>(&cancels, &continues, &signins);
BuildDialog(std::move(delegate));
widget_->Show();
EXPECT_EQ(nullptr, weak_dialog_->GetExtraView());
// Press the "Cancel" button.
views::Button* button = weak_dialog_->GetCancelButton();
PressButton(button);
EXPECT_EQ(cancels, 1);
EXPECT_EQ(continues, 0);
EXPECT_EQ(signins, 0);
}
...@@ -4208,6 +4208,23 @@ ...@@ -4208,6 +4208,23 @@
] ]
} }
], ],
"ManagedSigninPopup": [
{
"platforms": [
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"SyncConfirmationUpdatedText"
]
}
]
}
],
"MediaApp": [ "MediaApp": [
{ {
"platforms": [ "platforms": [
......
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