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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 }; | 121 }; |
122 | 122 |
123 class ExtensionWelcomeNotificationTest : public testing::Test { | 123 class ExtensionWelcomeNotificationTest : public testing::Test { |
124 protected: | 124 protected: |
125 ExtensionWelcomeNotificationTest() { | 125 ExtensionWelcomeNotificationTest() { |
126 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( | 126 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( |
127 new user_prefs::PrefRegistrySyncable()); | 127 new user_prefs::PrefRegistrySyncable()); |
128 ExtensionWelcomeNotification::RegisterProfilePrefs(pref_registry.get()); | 128 ExtensionWelcomeNotification::RegisterProfilePrefs(pref_registry.get()); |
129 } | 129 } |
130 | 130 |
131 virtual void SetUp() { | 131 void SetUp() override { |
132 task_runner_ = new base::TestSimpleTaskRunner(); | 132 task_runner_ = new base::TestSimpleTaskRunner(); |
133 thread_task_runner_handle_.reset( | 133 thread_task_runner_handle_.reset( |
134 new base::ThreadTaskRunnerHandle(task_runner_)); | 134 new base::ThreadTaskRunnerHandle(task_runner_)); |
135 profile_.reset(new TestingProfile()); | 135 profile_.reset(new TestingProfile()); |
136 delegate_ = new WelcomeNotificationDelegate(); | 136 delegate_ = new WelcomeNotificationDelegate(); |
137 welcome_notification_.reset( | 137 welcome_notification_.reset( |
138 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); | 138 ExtensionWelcomeNotification::Create(profile_.get(), delegate_)); |
139 } | 139 } |
140 | 140 |
141 virtual void TearDown() { | 141 void TearDown() override { |
142 delegate_ = NULL; | 142 delegate_ = NULL; |
143 welcome_notification_.reset(); | 143 welcome_notification_.reset(); |
144 profile_.reset(); | 144 profile_.reset(); |
145 thread_task_runner_handle_.reset(); | 145 thread_task_runner_handle_.reset(); |
146 task_runner_ = NULL; | 146 task_runner_ = NULL; |
147 } | 147 } |
148 | 148 |
149 void StartPreferenceSyncing() const { | 149 void StartPreferenceSyncing() const { |
150 PrefServiceSyncable::FromProfile(profile_.get()) | 150 PrefServiceSyncable::FromProfile(profile_.get()) |
151 ->GetSyncableService(syncer::PREFERENCES) | 151 ->GetSyncableService(syncer::PREFERENCES) |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); | 534 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); |
535 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 535 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
536 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 536 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
537 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 537 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
538 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 538 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
539 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 539 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
540 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 540 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
541 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 541 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
542 } | 542 } |
OLD | NEW |