OLD | NEW |
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/notification_service_impl.h" | |
17 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/notification_service.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 content::NotificationService::current()->Notify( | 27 content::NotificationService::current()->Notify( |
(...skipping 25 matching lines...) Expand all Loading... |
53 | 53 |
54 private: | 54 private: |
55 friend class base::RefCountedThreadSafe<ThreadNotificationService>; | 55 friend class base::RefCountedThreadSafe<ThreadNotificationService>; |
56 virtual ~ThreadNotificationService(); | 56 virtual ~ThreadNotificationService(); |
57 | 57 |
58 void InitTask(); | 58 void InitTask(); |
59 void TearDownTask(); | 59 void TearDownTask(); |
60 | 60 |
61 base::WaitableEvent done_event_; | 61 base::WaitableEvent done_event_; |
62 base::Thread* notification_thread_; | 62 base::Thread* notification_thread_; |
63 scoped_ptr<NotificationServiceImpl> service_; | 63 scoped_ptr<content::NotificationService> service_; |
64 }; | 64 }; |
65 | 65 |
66 class ThreadNotifier : // NOLINT | 66 class ThreadNotifier : // NOLINT |
67 public base::RefCountedThreadSafe<ThreadNotifier> { | 67 public base::RefCountedThreadSafe<ThreadNotifier> { |
68 public: | 68 public: |
69 explicit ThreadNotifier(base::Thread* notify_thread); | 69 explicit ThreadNotifier(base::Thread* notify_thread); |
70 | 70 |
71 void Notify(int type, const content::NotificationDetails& details); | 71 void Notify(int type, const content::NotificationDetails& details); |
72 | 72 |
73 void Notify(int type, | 73 void Notify(int type, |
74 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
75 const content::NotificationDetails& details); | 75 const content::NotificationDetails& details); |
76 | 76 |
77 private: | 77 private: |
78 friend class base::RefCountedThreadSafe<ThreadNotifier>; | 78 friend class base::RefCountedThreadSafe<ThreadNotifier>; |
79 virtual ~ThreadNotifier(); | 79 virtual ~ThreadNotifier(); |
80 | 80 |
81 void NotifyTask(int type, | 81 void NotifyTask(int type, |
82 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
83 const content::NotificationDetails& details); | 83 const content::NotificationDetails& details); |
84 | 84 |
85 base::WaitableEvent done_event_; | 85 base::WaitableEvent done_event_; |
86 base::Thread* notify_thread_; | 86 base::Thread* notify_thread_; |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 89 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
OLD | NEW |