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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ExtensionWelcomeNotificationTest() { | 132 ExtensionWelcomeNotificationTest() { |
133 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( | 133 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( |
134 new user_prefs::PrefRegistrySyncable()); | 134 new user_prefs::PrefRegistrySyncable()); |
135 ExtensionWelcomeNotification::RegisterProfilePrefs(pref_registry.get()); | 135 ExtensionWelcomeNotification::RegisterProfilePrefs(pref_registry.get()); |
136 } | 136 } |
137 | 137 |
138 void SetUp() override { | 138 void SetUp() override { |
139 task_runner_ = new base::TestSimpleTaskRunner(); | 139 task_runner_ = new base::TestSimpleTaskRunner(); |
140 base::MessageLoop::current()->SetTaskRunner(task_runner_); | 140 base::MessageLoop::current()->SetTaskRunner(task_runner_); |
141 profile_.reset(new TestingProfile()); | 141 profile_.reset(new TestingProfile()); |
| 142 task_runner()->RunUntilIdle(); |
142 delegate_ = new WelcomeNotificationDelegate(); | 143 delegate_ = new WelcomeNotificationDelegate(); |
143 welcome_notification_.reset( | 144 welcome_notification_.reset( |
144 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); | 145 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); |
145 } | 146 } |
146 | 147 |
147 void TearDown() override { | 148 void TearDown() override { |
148 delegate_ = NULL; | 149 delegate_ = NULL; |
149 welcome_notification_.reset(); | 150 welcome_notification_.reset(); |
150 profile_.reset(); | 151 profile_.reset(); |
151 TestingBrowserProcess::DeleteInstance(); | 152 TestingBrowserProcess::DeleteInstance(); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 530 |
530 EXPECT_FALSE(task_runner()->HasPendingTask()); | 531 EXPECT_FALSE(task_runner()->HasPendingTask()); |
531 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 532 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
532 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 533 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
533 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 534 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
534 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 535 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
535 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 536 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
536 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 537 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
537 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 538 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
538 } | 539 } |
OLD | NEW |