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

Side by Side Diff: chrome/browser/sync/profile_sync_test_util.h

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "chrome/browser/sync/profile_sync_service_observer.h" 15 #include "chrome/browser/sync/profile_sync_service_observer.h"
16 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
17 #include "content/common/notification_service.h" 17 #include "content/browser/notification_service_impl.h"
18 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
19 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 21
22 namespace base { 22 namespace base {
23 class Thread; 23 class Thread;
24 } 24 }
25 25
26 ACTION_P(Notify, type) { 26 ACTION_P(Notify, type) {
27 NotificationService::current()->Notify(type, 27 content::NotificationService::current()->Notify(
28 NotificationService::AllSources(), 28 type,
29 NotificationService::NoDetails()); 29 content::NotificationService::AllSources(),
30 content::NotificationService::NoDetails());
30 } 31 }
31 32
32 ACTION(QuitUIMessageLoop) { 33 ACTION(QuitUIMessageLoop) {
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
34 MessageLoop::current()->Quit(); 35 MessageLoop::current()->Quit();
35 } 36 }
36 37
37 class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver { 38 class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver {
38 public: 39 public:
39 ProfileSyncServiceObserverMock(); 40 ProfileSyncServiceObserverMock();
(...skipping 12 matching lines...) Expand all
52 53
53 private: 54 private:
54 friend class base::RefCountedThreadSafe<ThreadNotificationService>; 55 friend class base::RefCountedThreadSafe<ThreadNotificationService>;
55 virtual ~ThreadNotificationService(); 56 virtual ~ThreadNotificationService();
56 57
57 void InitTask(); 58 void InitTask();
58 void TearDownTask(); 59 void TearDownTask();
59 60
60 base::WaitableEvent done_event_; 61 base::WaitableEvent done_event_;
61 base::Thread* notification_thread_; 62 base::Thread* notification_thread_;
62 scoped_ptr<NotificationService> service_; 63 scoped_ptr<NotificationServiceImpl> service_;
63 }; 64 };
64 65
65 class ThreadNotifier : // NOLINT 66 class ThreadNotifier : // NOLINT
66 public base::RefCountedThreadSafe<ThreadNotifier> { 67 public base::RefCountedThreadSafe<ThreadNotifier> {
67 public: 68 public:
68 explicit ThreadNotifier(base::Thread* notify_thread); 69 explicit ThreadNotifier(base::Thread* notify_thread);
69 70
70 void Notify(int type, const content::NotificationDetails& details); 71 void Notify(int type, const content::NotificationDetails& details);
71 72
72 void Notify(int type, 73 void Notify(int type,
73 const content::NotificationSource& source, 74 const content::NotificationSource& source,
74 const content::NotificationDetails& details); 75 const content::NotificationDetails& details);
75 76
76 private: 77 private:
77 friend class base::RefCountedThreadSafe<ThreadNotifier>; 78 friend class base::RefCountedThreadSafe<ThreadNotifier>;
78 virtual ~ThreadNotifier(); 79 virtual ~ThreadNotifier();
79 80
80 void NotifyTask(int type, 81 void NotifyTask(int type,
81 const content::NotificationSource& source, 82 const content::NotificationSource& source,
82 const content::NotificationDetails& details); 83 const content::NotificationDetails& details);
83 84
84 base::WaitableEvent done_event_; 85 base::WaitableEvent done_event_;
85 base::Thread* notify_thread_; 86 base::Thread* notify_thread_;
86 }; 87 };
87 88
88 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ 89 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/profile_sync_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698