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

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

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Fixing ChromeOS and Linux compilation Created 5 years, 3 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"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/test/test_simple_task_runner.h" 13 #include "base/test/test_simple_task_runner.h"
14 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
15 #include "chrome/browser/notifications/notification.h" 15 #include "chrome/browser/notifications/notification.h"
16 #include "chrome/browser/prefs/pref_service_syncable_util.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "chrome/test/base/testing_browser_process.h" 18 #include "chrome/test/base/testing_browser_process.h"
18 #include "chrome/test/base/testing_pref_service_syncable.h" 19 #include "chrome/test/base/testing_pref_service_syncable.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 21 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "sync/api/fake_sync_change_processor.h" 22 #include "sync/api/fake_sync_change_processor.h"
22 #include "sync/api/sync_error_factory_mock.h" 23 #include "sync/api/sync_error_factory_mock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/message_center/fake_message_center.h" 25 #include "ui/message_center/fake_message_center.h"
25 #include "ui/message_center/notification.h" 26 #include "ui/message_center/notification.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void TearDown() override { 143 void TearDown() override {
143 delegate_ = NULL; 144 delegate_ = NULL;
144 welcome_notification_.reset(); 145 welcome_notification_.reset();
145 profile_.reset(); 146 profile_.reset();
146 TestingBrowserProcess::DeleteInstance(); 147 TestingBrowserProcess::DeleteInstance();
147 thread_task_runner_handle_.reset(); 148 thread_task_runner_handle_.reset();
148 task_runner_ = NULL; 149 task_runner_ = NULL;
149 } 150 }
150 151
151 void StartPreferenceSyncing() const { 152 void StartPreferenceSyncing() const {
152 PrefServiceSyncable::FromProfile(profile_.get()) 153 PrefServiceSyncableFromProfile(profile_.get())
153 ->GetSyncableService(syncer::PREFERENCES) 154 ->GetSyncableService(syncer::PREFERENCES)
154 ->MergeDataAndStartSyncing(syncer::PREFERENCES, 155 ->MergeDataAndStartSyncing(syncer::PREFERENCES,
155 syncer::SyncDataList(), 156 syncer::SyncDataList(),
156 scoped_ptr<syncer::SyncChangeProcessor>( 157 scoped_ptr<syncer::SyncChangeProcessor>(
157 new syncer::FakeSyncChangeProcessor), 158 new syncer::FakeSyncChangeProcessor),
158 scoped_ptr<syncer::SyncErrorFactory>( 159 scoped_ptr<syncer::SyncErrorFactory>(
159 new syncer::SyncErrorFactoryMock())); 160 new syncer::SyncErrorFactoryMock()));
160 } 161 }
161 162
162 void ShowChromeNowNotification() const { 163 void ShowChromeNowNotification() const {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 525
525 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); 526 EXPECT_TRUE(task_runner()->GetPendingTasks().empty());
526 EXPECT_EQ(message_center()->add_notification_calls(), 0); 527 EXPECT_EQ(message_center()->add_notification_calls(), 0);
527 EXPECT_EQ(message_center()->remove_notification_calls(), 0); 528 EXPECT_EQ(message_center()->remove_notification_calls(), 0);
528 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); 529 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0);
529 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); 530 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed));
530 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); 531 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal));
531 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); 532 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp));
532 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); 533 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1);
533 } 534 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/extension_welcome_notification.cc ('k') | chrome/browser/prefs/pref_metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698