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

Side by Side Diff: chrome/browser/notifications/extension_welcome_notification_unittest.cc

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style nit Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/extension_welcome_notification.h" 5 #include "chrome/browser/notifications/extension_welcome_notification.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 const std::string id_; 215 const std::string id_;
216 216
217 DISALLOW_COPY_AND_ASSIGN(TestNotificationDelegate); 217 DISALLOW_COPY_AND_ASSIGN(TestNotificationDelegate);
218 }; 218 };
219 219
220 void ShowNotification(std::string notification_id, 220 void ShowNotification(std::string notification_id,
221 const message_center::NotifierId& notifier_id) const { 221 const message_center::NotifierId& notifier_id) const {
222 message_center::RichNotificationData rich_notification_data; 222 message_center::RichNotificationData rich_notification_data;
223 rich_notification_data.priority = 0; 223 rich_notification_data.priority = 0;
224 Notification notification(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 224 Notification notification(
225 GURL("http://tests.url"), 225 message_center::NOTIFICATION_TYPE_BASE_FORMAT,
226 base::UTF8ToUTF16("Title"), 226 base::UTF8ToUTF16("Title"), base::UTF8ToUTF16("Body"), gfx::Image(),
227 base::UTF8ToUTF16("Body"), 227 notifier_id, base::UTF8ToUTF16("Source"), GURL("http://tests.url"),
228 gfx::Image(), 228 notification_id, rich_notification_data,
229 notifier_id, 229 new TestNotificationDelegate("TestNotification"));
230 base::UTF8ToUTF16("Source"),
231 notification_id,
232 rich_notification_data,
233 new TestNotificationDelegate("TestNotification"));
234 welcome_notification_->ShowWelcomeNotificationIfNecessary(notification); 230 welcome_notification_->ShowWelcomeNotificationIfNecessary(notification);
235 } 231 }
236 232
237 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; 233 scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
238 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; 234 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_;
239 scoped_ptr<TestingProfile> profile_; 235 scoped_ptr<TestingProfile> profile_;
240 // Weak Ref owned by welcome_notification_ 236 // Weak Ref owned by welcome_notification_
241 WelcomeNotificationDelegate* delegate_; 237 WelcomeNotificationDelegate* delegate_;
242 scoped_ptr<ExtensionWelcomeNotification> welcome_notification_; 238 scoped_ptr<ExtensionWelcomeNotification> welcome_notification_;
243 239
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 524
529 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); 525 EXPECT_TRUE(task_runner()->GetPendingTasks().empty());
530 EXPECT_EQ(message_center()->add_notification_calls(), 0); 526 EXPECT_EQ(message_center()->add_notification_calls(), 0);
531 EXPECT_EQ(message_center()->remove_notification_calls(), 0); 527 EXPECT_EQ(message_center()->remove_notification_calls(), 0);
532 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); 528 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0);
533 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); 529 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed));
534 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); 530 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal));
535 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); 531 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp));
536 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); 532 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1);
537 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698