Commit bf215fe5 authored by mukai's avatar mukai Committed by Commit bot

Put display messages as 'additional' message.

Notification title has 2-line limit, therefore sometimes long
messages are cut off. The 'body' field has much more space for
longer text.

BUG=454827
R=oshima@chromium.org
TEST=manually

Review URL: https://codereview.chromium.org/1094863006

Cr-Commit-Position: refs/heads/master@{#326692}
parent 163a4a63
......@@ -334,10 +334,9 @@ bool TrayDisplay::GetDisplayMessageForNotification(
if (iter->second.configured_ui_scale() !=
old_iter->second.configured_ui_scale()) {
*message_out = l10n_util::GetStringFUTF16(
*additional_message_out = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
GetDisplayName(iter->first),
GetDisplaySize(iter->first));
GetDisplayName(iter->first), GetDisplaySize(iter->first));
return true;
}
if (iter->second.GetActiveRotation() !=
......@@ -357,9 +356,8 @@ bool TrayDisplay::GetDisplayMessageForNotification(
rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270;
break;
}
*message_out = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED,
GetDisplayName(iter->first),
*additional_message_out = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter->first),
l10n_util::GetStringUTF16(rotation_text_id));
return true;
}
......@@ -377,7 +375,7 @@ void TrayDisplay::CreateOrUpdateNotification(
message_center::MessageCenter::Get()->RemoveNotification(
kNotificationId, false /* by_user */);
if (message.empty())
if (message.empty() && additional_message.empty())
return;
// Don't display notifications for accelerometer triggered screen rotations.
......
......@@ -423,43 +423,39 @@ TEST_F(TrayDisplayTest, DisplayNotifications) {
// rotation.
UpdateDisplay("400x400/r");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(),
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
CloseNotification();
UpdateDisplay("400x400");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(),
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION)),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
// UI-scale
CloseNotification();
UpdateDisplay("400x400@1.5");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
GetFirstDisplayName(), base::UTF8ToUTF16("600x600")),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
// UI-scale to 1.0
CloseNotification();
UpdateDisplay("400x400");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
GetFirstDisplayName(), base::UTF8ToUTF16("400x400")),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
// No-update
CloseNotification();
......@@ -497,23 +493,20 @@ TEST_F(TrayDisplayTest, DisplayNotifications) {
// Resize the first display.
UpdateDisplay("400x400@1.5,200x200");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED,
GetFirstDisplayName(), base::UTF8ToUTF16("600x600")),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
// Rotate the second.
UpdateDisplay("400x400@1.5,200x200/r");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED,
GetSecondDisplayName(),
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(),
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
GetDisplayNotificationText());
EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty());
GetDisplayNotificationAdditionalText());
EXPECT_TRUE(GetDisplayNotificationText().empty());
// Enters closed lid mode.
UpdateDisplay("400x400@1.5,200x200");
......@@ -563,13 +556,11 @@ TEST_F(TrayDisplayTest, UpdateAfterSuppressDisplayNotification) {
// rotate the second.
UpdateDisplay("400x400,200x200/r");
EXPECT_EQ(
l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED,
GetSecondDisplayName(),
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(),
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
GetDisplayNotificationText());
GetDisplayNotificationAdditionalText());
}
} // namespace ash
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