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(); | |
143 delegate_ = new WelcomeNotificationDelegate(); | 142 delegate_ = new WelcomeNotificationDelegate(); |
144 welcome_notification_.reset( | 143 welcome_notification_.reset( |
145 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); | 144 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); |
146 } | 145 } |
147 | 146 |
148 void TearDown() override { | 147 void TearDown() override { |
149 delegate_ = NULL; | 148 delegate_ = NULL; |
150 welcome_notification_.reset(); | 149 welcome_notification_.reset(); |
151 profile_.reset(); | 150 profile_.reset(); |
152 TestingBrowserProcess::DeleteInstance(); | 151 TestingBrowserProcess::DeleteInstance(); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 529 |
531 EXPECT_FALSE(task_runner()->HasPendingTask()); | 530 EXPECT_FALSE(task_runner()->HasPendingTask()); |
532 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 531 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
533 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 532 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
534 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 533 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
535 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 534 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
536 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 535 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
537 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 536 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
538 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 537 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
539 } | 538 } |
OLD | NEW |