OLD | NEW |
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 void ShowNotification(std::string notification_id, | 218 void ShowNotification(std::string notification_id, |
219 const message_center::NotifierId& notifier_id) const { | 219 const message_center::NotifierId& notifier_id) const { |
220 message_center::RichNotificationData rich_notification_data; | 220 message_center::RichNotificationData rich_notification_data; |
221 rich_notification_data.priority = 0; | 221 rich_notification_data.priority = 0; |
222 Notification notification(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 222 Notification notification(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
223 GURL("http://tests.url"), | 223 GURL("http://tests.url"), |
224 base::UTF8ToUTF16("Title"), | 224 base::UTF8ToUTF16("Title"), |
225 base::UTF8ToUTF16("Body"), | 225 base::UTF8ToUTF16("Body"), |
226 gfx::Image(), | 226 gfx::Image(), |
227 blink::WebTextDirectionDefault, | |
228 notifier_id, | 227 notifier_id, |
229 base::UTF8ToUTF16("Source"), | 228 base::UTF8ToUTF16("Source"), |
230 base::UTF8ToUTF16(notification_id), | 229 base::UTF8ToUTF16(notification_id), |
231 rich_notification_data, | 230 rich_notification_data, |
232 new TestNotificationDelegate("TestNotification")); | 231 new TestNotificationDelegate("TestNotification")); |
233 welcome_notification_->ShowWelcomeNotificationIfNecessary(notification); | 232 welcome_notification_->ShowWelcomeNotificationIfNecessary(notification); |
234 } | 233 } |
235 | 234 |
236 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 235 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
237 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; | 236 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 526 |
528 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); | 527 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); |
529 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 528 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
530 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 529 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
531 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 530 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
532 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 531 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
533 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 532 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
534 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 533 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
535 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 534 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
536 } | 535 } |
OLD | NEW |