Commit e03299ea authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Chrome OS: Fix crash with auto connect notifier.

Also add checks to StubNotificationDisplayService test util class to
catch this in the future (checks match NotificationDisplayServiceImpl
production code).

Bug: 843692
Change-Id: Iebb64687dadf6eb50bffea80e946e8dd3336bac9
Reviewed-on: https://chromium-review.googlesource.com/1062653Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559307}
parent 7360ae32
...@@ -181,10 +181,12 @@ void StubNotificationDisplayService::Display( ...@@ -181,10 +181,12 @@ void StubNotificationDisplayService::Display(
true /* silent */); true /* silent */);
NotificationHandler* handler = GetNotificationHandler(notification_type); NotificationHandler* handler = GetNotificationHandler(notification_type);
if (notification_type == NotificationHandler::Type::TRANSIENT) if (notification_type == NotificationHandler::Type::TRANSIENT) {
DCHECK(!handler); CHECK(!handler);
else CHECK(notification.delegate());
} else {
handler->OnShow(profile_, notification.id()); handler->OnShow(profile_, notification.id());
}
notifications_.emplace_back(notification_type, notification, notifications_.emplace_back(notification_type, notification,
std::move(metadata)); std::move(metadata));
......
...@@ -132,7 +132,8 @@ void AutoConnectNotifier::DisplayNotification() { ...@@ -132,7 +132,8 @@ void AutoConnectNotifier::DisplayNotification() {
message_center::NotifierId( message_center::NotifierId(
message_center::NotifierId::NotifierType::SYSTEM_COMPONENT, message_center::NotifierId::NotifierType::SYSTEM_COMPONENT,
kNotifierAutoConnect), kNotifierAutoConnect),
{} /* optional_fields */, nullptr /* delegate */, {} /* optional_fields */,
base::MakeRefCounted<message_center::NotificationDelegate>(),
gfx::VectorIcon() /* small_image */, gfx::VectorIcon() /* small_image */,
message_center::SystemNotificationWarningLevel::NORMAL); message_center::SystemNotificationWarningLevel::NORMAL);
......
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