Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1302)

Unified Diff: content/shell/renderer/test_runner/notification_presenter.cc

Issue 183853026: Notification testing output should be more inclusive and consistent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually, let's do that later to not be blocked again. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/notification_presenter.cc
diff --git a/content/shell/renderer/test_runner/notification_presenter.cc b/content/shell/renderer/test_runner/notification_presenter.cc
index e6362d3131abf49f88ae5cae8289f136c4955e5d..80e6d5224ba4e0a77dd75447ebbbbc88ba49f277 100644
--- a/content/shell/renderer/test_runner/notification_presenter.cc
+++ b/content/shell/renderer/test_runner/notification_presenter.cc
@@ -63,8 +63,9 @@ void NotificationPresenter::CancelAllActiveNotifications() {
}
void NotificationPresenter::Reset() {
- // TODO(peter): Ensure that |active_notifications_| is empty as well.
+ CancelAllActiveNotifications();
known_origins_.clear();
+ replacements_.clear();
}
bool NotificationPresenter::show(const WebNotification& notification) {
@@ -77,19 +78,30 @@ bool NotificationPresenter::show(const WebNotification& notification) {
replacements_[replaceId] = notification.title().utf8();
}
- delegate_->printMessage("DESKTOP NOTIFICATION:");
- delegate_->printMessage(
- notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : "");
- delegate_->printMessage(" icon ");
- delegate_->printMessage(notification.iconURL().isEmpty()
- ? ""
- : notification.iconURL().spec().data());
- delegate_->printMessage(", title ");
- delegate_->printMessage(
- notification.title().isEmpty() ? "" : notification.title().utf8().data());
- delegate_->printMessage(", text ");
- delegate_->printMessage(
- notification.body().isEmpty() ? "" : notification.body().utf8().data());
+ delegate_->printMessage("DESKTOP NOTIFICATION SHOWN: ");
+ if (!notification.title().isEmpty())
+ delegate_->printMessage(notification.title().utf8().data());
+
+ if (notification.direction() == WebTextDirectionRightToLeft)
+ delegate_->printMessage(", RTL");
+
+ // TODO(beverloo): WebNotification should expose the "lang" attribute's value.
+
+ if (!notification.body().isEmpty()) {
+ delegate_->printMessage(std::string(", body: ") +
+ notification.body().utf8().data());
+ }
+
+ if (!notification.replaceId().isEmpty()) {
+ delegate_->printMessage(std::string(", tag: ") +
+ notification.replaceId().utf8().data());
+ }
+
+ if (!notification.iconURL().isEmpty()) {
+ delegate_->printMessage(std::string(", icon: ") +
+ notification.iconURL().spec().data());
+ }
+
delegate_->printMessage("\n");
std::string title = notification.title().utf8();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698