Commit 59d5ee7c authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Remove IsHarmonyMode and CONTEXT_DEPRECATED_SMALL

Replaces CONTEXT_DEPRECATED_SMALL with CONTEXT_BODY_TEXT_SMALL as
CONTEXT_DEPRECATED_SMALL isn't supported under Harmony and only a few
uses of it remained. The replacement font is usually 1pt larger than
the deprecated one.

Updates LayoutProviderTest.FontRelativeToBase to use the current layout
provider. Also makes use of ChromeLayoutProvider::CreateLayoutProvider
in ChromeTestViewsDelegate to keep it in sync with chrome.

Also updates test expectations as ChromeTestViewsDelegate gets updated
to make use of the ChromeLayoutProvider factory, which provides
HarmonyLayoutProvider in most cases instead of the legacy
ChromeLayoutProvider.

Bug: chromium:867557
Change-Id: I202757cc05854e1e3054b9f97220a5c99f025b30
Reviewed-on: https://chromium-review.googlesource.com/1171661Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582850}
parent 993a3910
...@@ -47,18 +47,6 @@ ...@@ -47,18 +47,6 @@
namespace { namespace {
// If we don't clamp the maximum width, then very long URLs and titles can make
// the bubble arbitrarily wide.
const int kMaxContentsWidth = 500;
// The new default width for the content settings bubble. The review process to
// the width on per-bubble basis is tracked with https://crbug.com/649650.
const int kMaxDefaultContentsWidth = 320;
// When we have multiline labels, we should set a minimum width lest we get very
// narrow bubbles with lots of line-wrapping.
const int kMinMultiLineContentsWidth = 250;
// Display a maximum of 4 visible items in a list before scrolling. // Display a maximum of 4 visible items in a list before scrolling.
const int kMaxVisibleListItems = 4; const int kMaxVisibleListItems = 4;
...@@ -402,33 +390,10 @@ void ContentSettingBubbleContents::WindowClosing() { ...@@ -402,33 +390,10 @@ void ContentSettingBubbleContents::WindowClosing() {
} }
gfx::Size ContentSettingBubbleContents::CalculatePreferredSize() const { gfx::Size ContentSettingBubbleContents::CalculatePreferredSize() const {
gfx::Size preferred_size(views::View::CalculatePreferredSize()); const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
int preferred_width = DISTANCE_BUBBLE_PREFERRED_WIDTH) -
(!content_setting_bubble_model_->bubble_content().domain_lists.empty() && margins().width();
(kMinMultiLineContentsWidth > preferred_size.width())) return gfx::Size(width, GetHeightForWidth(width));
? kMinMultiLineContentsWidth
: preferred_size.width();
if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) {
preferred_size.set_width(std::min(preferred_width,
kMaxDefaultContentsWidth));
} else {
preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth));
}
// These bubbles should all be the "small" dialog width, but only when in
// Harmony mode.
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
if (provider->IsHarmonyMode()) {
// Subtract out this dialog's margins. The margins are imposed by
// DialogClientView around this view, so this view's width plus the width of
// these margins must equal the desired width, which is
// GetSnappedDialogWidth(0).
preferred_size.set_width(provider->GetSnappedDialogWidth(0) -
margins().width());
preferred_size.set_height(GetHeightForWidth(preferred_size.width()));
}
return preferred_size;
} }
void ContentSettingBubbleContents::OnListItemAdded( void ContentSettingBubbleContents::OnListItemAdded(
...@@ -466,7 +431,7 @@ base::string16 ContentSettingBubbleContents::GetWindowTitle() const { ...@@ -466,7 +431,7 @@ base::string16 ContentSettingBubbleContents::GetWindowTitle() const {
} }
bool ContentSettingBubbleContents::ShouldShowCloseButton() const { bool ContentSettingBubbleContents::ShouldShowCloseButton() const {
return ChromeLayoutProvider::Get()->IsHarmonyMode(); return true;
} }
void ContentSettingBubbleContents::Init() { void ContentSettingBubbleContents::Init() {
......
...@@ -59,13 +59,12 @@ BookmarkAppConfirmationView::BookmarkAppConfirmationView( ...@@ -59,13 +59,12 @@ BookmarkAppConfirmationView::BookmarkAppConfirmationView(
views::GridLayout::kFixedSize, views::GridLayout::FIXED, views::GridLayout::kFixedSize, views::GridLayout::FIXED,
textfield_width, 0); textfield_width, 0);
const int icon_size = layout_provider->IsHarmonyMode()
? extension_misc::EXTENSION_ICON_SMALL
: extension_misc::EXTENSION_ICON_MEDIUM;
views::ImageView* icon_image_view = new views::ImageView(); views::ImageView* icon_image_view = new views::ImageView();
gfx::Size image_size(icon_size, icon_size); gfx::Size image_size(extension_misc::EXTENSION_ICON_SMALL,
extension_misc::EXTENSION_ICON_SMALL);
gfx::ImageSkia image( gfx::ImageSkia image(
std::make_unique<WebAppInfoImageSource>(icon_size, web_app_info_.icons), std::make_unique<WebAppInfoImageSource>(
extension_misc::EXTENSION_ICON_SMALL, web_app_info_.icons),
image_size); image_size);
icon_image_view->SetImageSize(image_size); icon_image_view->SetImageSize(image_size);
icon_image_view->SetImage(image); icon_image_view->SetImage(image);
......
...@@ -342,21 +342,14 @@ void ExtensionInstallDialogView::AddedToWidget() { ...@@ -342,21 +342,14 @@ void ExtensionInstallDialogView::AddedToWidget() {
prompt_->rating_count()); prompt_->rating_count());
prompt_->AppendRatingStars(AddResourceIcon, rating.get()); prompt_->AppendRatingStars(AddResourceIcon, rating.get());
rating_container->AddChildView(rating.release()); rating_container->AddChildView(rating.release());
int rating_text_context, user_count_text_context;
if (provider->IsHarmonyMode()) {
rating_text_context = CONTEXT_BODY_TEXT_LARGE;
user_count_text_context = CONTEXT_BODY_TEXT_SMALL;
} else {
rating_text_context = user_count_text_context = CONTEXT_DEPRECATED_SMALL;
}
auto rating_count = std::make_unique<RatingLabel>(prompt_->GetRatingCount(), auto rating_count = std::make_unique<RatingLabel>(prompt_->GetRatingCount(),
rating_text_context); CONTEXT_BODY_TEXT_LARGE);
rating_count->SetHorizontalAlignment(gfx::ALIGN_LEFT); rating_count->SetHorizontalAlignment(gfx::ALIGN_LEFT);
rating_container->AddChildView(rating_count.release()); rating_container->AddChildView(rating_count.release());
webstore_data_container->AddChildView(rating_container.release()); webstore_data_container->AddChildView(rating_container.release());
auto user_count = std::make_unique<views::Label>( auto user_count = std::make_unique<views::Label>(
prompt_->GetUserCount(), user_count_text_context, STYLE_SECONDARY); prompt_->GetUserCount(), CONTEXT_BODY_TEXT_SMALL, STYLE_SECONDARY);
user_count->SetAutoColorReadabilityEnabled(false); user_count->SetAutoColorReadabilityEnabled(false);
user_count->SetEnabledColor(SK_ColorGRAY); user_count->SetEnabledColor(SK_ColorGRAY);
user_count->SetHorizontalAlignment(gfx::ALIGN_LEFT); user_count->SetHorizontalAlignment(gfx::ALIGN_LEFT);
......
...@@ -118,7 +118,3 @@ bool ChromeLayoutProvider::UseExtraDialogPadding() const { ...@@ -118,7 +118,3 @@ bool ChromeLayoutProvider::UseExtraDialogPadding() const {
bool ChromeLayoutProvider::ShouldShowWindowIcon() const { bool ChromeLayoutProvider::ShouldShowWindowIcon() const {
return true; return true;
} }
bool ChromeLayoutProvider::IsHarmonyMode() const {
return false;
}
...@@ -91,14 +91,6 @@ class ChromeLayoutProvider : public views::LayoutProvider { ...@@ -91,14 +91,6 @@ class ChromeLayoutProvider : public views::LayoutProvider {
// Returns whether to show the icon next to the title text on a dialog. // Returns whether to show the icon next to the title text on a dialog.
virtual bool ShouldShowWindowIcon() const; virtual bool ShouldShowWindowIcon() const;
// DEPRECATED. Returns whether Harmony mode is enabled.
//
// Instead of using this, create a generic solution that works for all UI
// types, e.g. by adding a new LayoutDistance value that means what you need.
//
// TODO(pkasting): Fix callers and remove this.
virtual bool IsHarmonyMode() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider);
}; };
......
...@@ -128,9 +128,6 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int context, ...@@ -128,9 +128,6 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
case CONTEXT_BODY_TEXT_SMALL: case CONTEXT_BODY_TEXT_SMALL:
size_delta = ui::kLabelFontSizeDelta; size_delta = ui::kLabelFontSizeDelta;
break; break;
case CONTEXT_DEPRECATED_SMALL:
size_delta = ui::ResourceBundle::kSmallFontDelta;
break;
} }
switch (style) { switch (style) {
......
...@@ -44,11 +44,6 @@ enum ChromeTextContext { ...@@ -44,11 +44,6 @@ enum ChromeTextContext {
// mimic the native Windows 10 look and feel. // mimic the native Windows 10 look and feel.
CONTEXT_WINDOWS10_NATIVE, CONTEXT_WINDOWS10_NATIVE,
// ui::ResourceBundle::SmallFont (11 pt). There is no equivalent in the
// Harmony spec, so new code should not be using this. It is only provided to
// avoid changing existing UI and it will eventually be removed.
CONTEXT_DEPRECATED_SMALL,
// ToolbarButton label // ToolbarButton label
CONTEXT_TOOLBAR_BUTTON, CONTEXT_TOOLBAR_BUTTON,
}; };
......
...@@ -131,10 +131,6 @@ bool HarmonyLayoutProvider::ShouldShowWindowIcon() const { ...@@ -131,10 +131,6 @@ bool HarmonyLayoutProvider::ShouldShowWindowIcon() const {
return false; return false;
} }
bool HarmonyLayoutProvider::IsHarmonyMode() const {
return true;
}
int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const { int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const {
for (int snap_point : {kSmallSnapPoint, kMediumSnapPoint, kLargeSnapPoint}) { for (int snap_point : {kSmallSnapPoint, kMediumSnapPoint, kLargeSnapPoint}) {
if (min_width <= snap_point) if (min_width <= snap_point)
......
...@@ -22,7 +22,6 @@ class HarmonyLayoutProvider : public ChromeLayoutProvider { ...@@ -22,7 +22,6 @@ class HarmonyLayoutProvider : public ChromeLayoutProvider {
views::GridLayout::Alignment GetControlLabelGridAlignment() const override; views::GridLayout::Alignment GetControlLabelGridAlignment() const override;
bool UseExtraDialogPadding() const override; bool UseExtraDialogPadding() const override;
bool ShouldShowWindowIcon() const override; bool ShouldShowWindowIcon() const override;
bool IsHarmonyMode() const override;
const views::TypographyProvider& GetTypographyProvider() const override; const views::TypographyProvider& GetTypographyProvider() const override;
int GetSnappedDialogWidth(int min_width) const override; int GetSnappedDialogWidth(int min_width) const override;
......
...@@ -244,11 +244,10 @@ TEST_F(LayoutProviderTest, FontSizeRelativeToBase) { ...@@ -244,11 +244,10 @@ TEST_F(LayoutProviderTest, FontSizeRelativeToBase) {
constexpr int kStyle = views::style::STYLE_PRIMARY; constexpr int kStyle = views::style::STYLE_PRIMARY;
// Typography described in chrome_typography.h requires a std::unique_ptr<views::LayoutProvider> layout_provider =
// ChromeLayoutProvider. ChromeLayoutProvider::CreateLayoutProvider();
ChromeLayoutProvider layout_provider;
// Legacy code measures everything relative to a default-constructed FontList. // Everything's measured relative to a default-constructed FontList.
// On Mac, subtract one since that is 13pt instead of 12pt. // On Mac, subtract one since that is 13pt instead of 12pt.
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
const int twelve = gfx::FontList().GetFontSize() - 1; const int twelve = gfx::FontList().GetFontSize() - 1;
...@@ -263,24 +262,12 @@ TEST_F(LayoutProviderTest, FontSizeRelativeToBase) { ...@@ -263,24 +262,12 @@ TEST_F(LayoutProviderTest, FontSizeRelativeToBase) {
EXPECT_EQ(twelve, EXPECT_EQ(twelve,
GetFont(views::style::CONTEXT_BUTTON, kStyle).GetFontSize()); GetFont(views::style::CONTEXT_BUTTON, kStyle).GetFontSize());
#if defined(OS_MACOSX)
// We never exposed UI on Mac using these constants so it doesn't matter that
// they are different. They only need to match under Harmony.
EXPECT_EQ(twelve + 9, GetFont(CONTEXT_HEADLINE, kStyle).GetFontSize());
EXPECT_EQ(twelve + 2,
GetFont(views::style::CONTEXT_DIALOG_TITLE, kStyle).GetFontSize());
EXPECT_EQ(twelve + 2, GetFont(CONTEXT_BODY_TEXT_LARGE, kStyle).GetFontSize());
EXPECT_EQ(twelve, GetFont(CONTEXT_DEPRECATED_SMALL, kStyle).GetFontSize());
#else
// E.g. Headline should give a 20pt font. // E.g. Headline should give a 20pt font.
EXPECT_EQ(twelve + 8, GetFont(CONTEXT_HEADLINE, kStyle).GetFontSize()); EXPECT_EQ(twelve + 8, GetFont(CONTEXT_HEADLINE, kStyle).GetFontSize());
// Titles should be 15pt. Etc. // Titles should be 15pt. Etc.
EXPECT_EQ(twelve + 3, EXPECT_EQ(twelve + 3,
GetFont(views::style::CONTEXT_DIALOG_TITLE, kStyle).GetFontSize()); GetFont(views::style::CONTEXT_DIALOG_TITLE, kStyle).GetFontSize());
EXPECT_EQ(twelve + 1, GetFont(CONTEXT_BODY_TEXT_LARGE, kStyle).GetFontSize()); EXPECT_EQ(twelve + 1, GetFont(CONTEXT_BODY_TEXT_LARGE, kStyle).GetFontSize());
EXPECT_EQ(twelve - 1,
GetFont(CONTEXT_DEPRECATED_SMALL, kStyle).GetFontSize());
#endif
} }
// Ensure that line height can be overridden by Chrome's TypographyProvider for // Ensure that line height can be overridden by Chrome's TypographyProvider for
......
...@@ -90,9 +90,7 @@ CredentialsItemView::CredentialsItemView( ...@@ -90,9 +90,7 @@ CredentialsItemView::CredentialsItemView(
// TODO(tapted): Check these (and the STYLE_ values below) against the spec on // TODO(tapted): Check these (and the STYLE_ values below) against the spec on
// http://crbug.com/651681. // http://crbug.com/651681.
const int kLabelContext = ChromeLayoutProvider::Get()->IsHarmonyMode() const int kLabelContext = CONTEXT_BODY_TEXT_SMALL;
? CONTEXT_BODY_TEXT_SMALL
: CONTEXT_DEPRECATED_SMALL;
if (!upper_text.empty()) { if (!upper_text.empty()) {
upper_label_ = new views::Label(upper_text, kLabelContext, upper_label_ = new views::Label(upper_text, kLabelContext,
......
...@@ -33,20 +33,14 @@ PasswordAutoSignInView::PasswordAutoSignInView( ...@@ -33,20 +33,14 @@ PasswordAutoSignInView::PasswordAutoSignInView(
: PasswordBubbleViewBase(web_contents, anchor_view, anchor_point, reason) { : PasswordBubbleViewBase(web_contents, anchor_view, anchor_point, reason) {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
const autofill::PasswordForm& form = model()->pending_password(); const autofill::PasswordForm& form = model()->pending_password();
base::string16 upper_text, lower_text = form.username_value;
set_margins( set_margins(
ChromeLayoutProvider::Get()->GetInsetsMetric(views::INSETS_DIALOG)); ChromeLayoutProvider::Get()->GetInsetsMetric(views::INSETS_DIALOG));
if (ChromeLayoutProvider::Get()->IsHarmonyMode()) {
upper_text =
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE_MD);
} else {
lower_text = l10n_util::GetStringFUTF16(
IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, lower_text);
}
CredentialsItemView* credential = new CredentialsItemView( CredentialsItemView* credential = new CredentialsItemView(
this, upper_text, lower_text, kButtonHoverColor, &form, this,
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE_MD),
form.username_value, kButtonHoverColor, &form,
content::BrowserContext::GetDefaultStoragePartition(model()->GetProfile()) content::BrowserContext::GetDefaultStoragePartition(model()->GetProfile())
->GetURLLoaderFactoryForBrowserProcess() ->GetURLLoaderFactoryForBrowserProcess()
.get()); .get());
......
...@@ -59,7 +59,7 @@ std::unique_ptr<views::View> CreateErrorLabelView( ...@@ -59,7 +59,7 @@ std::unique_ptr<views::View> CreateErrorLabelView(
view->SetLayoutManager(std::move(layout)); view->SetLayoutManager(std::move(layout));
std::unique_ptr<views::Label> error_label = std::unique_ptr<views::Label> error_label =
std::make_unique<views::Label>(error, CONTEXT_DEPRECATED_SMALL); std::make_unique<views::Label>(error, CONTEXT_BODY_TEXT_SMALL);
error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) +
type); type);
error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor(
......
...@@ -128,8 +128,8 @@ class PaymentMethodListItem : public PaymentRequestItemList::Item { ...@@ -128,8 +128,8 @@ class PaymentMethodListItem : public PaymentRequestItemList::Item {
base::string16 missing_info; base::string16 missing_info;
if (!instrument_->IsCompleteForPayment()) { if (!instrument_->IsCompleteForPayment()) {
missing_info = instrument_->GetMissingInfoLabel(); missing_info = instrument_->GetMissingInfoLabel();
auto missing_info_label = std::make_unique<views::Label>( auto missing_info_label =
missing_info, CONTEXT_DEPRECATED_SMALL); std::make_unique<views::Label>(missing_info, CONTEXT_BODY_TEXT_SMALL);
missing_info_label->SetEnabledColor( missing_info_label->SetEnabledColor(
missing_info_label->GetNativeTheme()->GetSystemColor( missing_info_label->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_LinkEnabled)); ui::NativeTheme::kColorId_LinkEnabled));
......
...@@ -139,7 +139,7 @@ std::unique_ptr<views::View> GetShippingAddressLabel( ...@@ -139,7 +139,7 @@ std::unique_ptr<views::View> GetShippingAddressLabel(
std::unique_ptr<views::Label> GetLabelForMissingInformation( std::unique_ptr<views::Label> GetLabelForMissingInformation(
const base::string16& missing_info) { const base::string16& missing_info) {
std::unique_ptr<views::Label> label = std::unique_ptr<views::Label> label =
std::make_unique<views::Label>(missing_info, CONTEXT_DEPRECATED_SMALL); std::make_unique<views::Label>(missing_info, CONTEXT_BODY_TEXT_SMALL);
label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_ERROR)); label->set_id(static_cast<int>(DialogViewID::PROFILE_LABEL_ERROR));
// Missing information typically has a nice shade of blue. // Missing information typically has a nice shade of blue.
label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor( label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
......
...@@ -1359,7 +1359,7 @@ views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { ...@@ -1359,7 +1359,7 @@ views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() {
kMenuEdgeMargin, horizontal_margin)); kMenuEdgeMargin, horizontal_margin));
views::Label* disclaimer = new views::Label( views::Label* disclaimer = new views::Label(
avatar_menu_->GetSupervisedUserInformation(), CONTEXT_DEPRECATED_SMALL); avatar_menu_->GetSupervisedUserInformation(), CONTEXT_BODY_TEXT_SMALL);
disclaimer->SetMultiLine(true); disclaimer->SetMultiLine(true);
disclaimer->SetAllowCharacterBreak(true); disclaimer->SetAllowCharacterBreak(true);
disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT);
...@@ -1553,12 +1553,12 @@ views::View* ProfileChooserView::CreateAccountRemovalView() { ...@@ -1553,12 +1553,12 @@ views::View* ProfileChooserView::CreateAccountRemovalView() {
primary_account_removal_label->AddStyleRange( primary_account_removal_label->AddStyleRange(
gfx::Range(offsets[1], offsets[1] + settings_text.size()), gfx::Range(offsets[1], offsets[1] + settings_text.size()),
views::StyledLabel::RangeStyleInfo::CreateForLink()); views::StyledLabel::RangeStyleInfo::CreateForLink());
primary_account_removal_label->SetTextContext(CONTEXT_DEPRECATED_SMALL); primary_account_removal_label->SetTextContext(CONTEXT_BODY_TEXT_SMALL);
layout->AddView(primary_account_removal_label); layout->AddView(primary_account_removal_label);
} else { } else {
views::Label* content_label = new views::Label( views::Label* content_label = new views::Label(
l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_TEXT), l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_TEXT),
CONTEXT_DEPRECATED_SMALL); CONTEXT_BODY_TEXT_SMALL);
content_label->SetMultiLine(true); content_label->SetMultiLine(true);
content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->AddView(content_label); layout->AddView(content_label);
......
...@@ -431,7 +431,7 @@ TEST_P(TabStripTest, TabCloseButtonVisibilityWhenStacked) { ...@@ -431,7 +431,7 @@ TEST_P(TabStripTest, TabCloseButtonVisibilityWhenStacked) {
return; return;
} }
tab_strip_->SetBounds(0, 0, 320, 20); tab_strip_->SetBounds(0, 0, 360, 20);
controller_->AddTab(0, false); controller_->AddTab(0, false);
controller_->AddTab(1, true); controller_->AddTab(1, true);
controller_->AddTab(2, false); controller_->AddTab(2, false);
...@@ -507,7 +507,7 @@ TEST_P(TabStripTest, TabCloseButtonVisibilityWhenNotStacked) { ...@@ -507,7 +507,7 @@ TEST_P(TabStripTest, TabCloseButtonVisibilityWhenNotStacked) {
// Set the tab strip width to be wide enough for three tabs to show all // Set the tab strip width to be wide enough for three tabs to show all
// three icons, but not enough for five tabs to show all three icons. // three icons, but not enough for five tabs to show all three icons.
tab_strip_->SetBounds(0, 0, 320, 20); tab_strip_->SetBounds(0, 0, 360, 20);
controller_->AddTab(0, false); controller_->AddTab(0, false);
controller_->AddTab(1, true); controller_->AddTab(1, true);
controller_->AddTab(2, false); controller_->AddTab(2, false);
......
...@@ -683,11 +683,12 @@ TEST_F(TabTest, ExtraAlertPaddingNotShownOnSmallActiveTab) { ...@@ -683,11 +683,12 @@ TEST_F(TabTest, ExtraAlertPaddingNotShownOnSmallActiveTab) {
tab.SetData(data); tab.SetData(data);
tab.SetBounds(0, 0, 200, 50); tab.SetBounds(0, 0, 200, 50);
EXPECT_TRUE(GetTabIcon(tab)->visible());
const views::View* close = GetCloseButton(tab); const views::View* close = GetCloseButton(tab);
const views::View* alert = GetAlertIndicator(tab); const views::View* alert = GetAlertIndicator(tab);
const int original_spacing = close->x() - alert->bounds().right(); const int original_spacing = close->x() - alert->bounds().right();
tab.SetBounds(0, 0, 60, 50); tab.SetBounds(0, 0, 70, 50);
EXPECT_FALSE(GetTabIcon(tab)->visible()); EXPECT_FALSE(GetTabIcon(tab)->visible());
EXPECT_TRUE(close->visible()); EXPECT_TRUE(close->visible());
EXPECT_TRUE(alert->visible()); EXPECT_TRUE(alert->visible());
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
ChromeTestViewsDelegate::ChromeTestViewsDelegate() ChromeTestViewsDelegate::ChromeTestViewsDelegate()
: views::TestViewsDelegate() { : views::TestViewsDelegate() {
// Overrides the LayoutProvider created by TestViewsDelegate. // Overrides the LayoutProvider created by TestViewsDelegate.
set_layout_provider(std::make_unique<ChromeLayoutProvider>()); set_layout_provider(ChromeLayoutProvider::CreateLayoutProvider());
} }
ChromeTestViewsDelegate::~ChromeTestViewsDelegate() {} ChromeTestViewsDelegate::~ChromeTestViewsDelegate() {}
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