| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver { | 38 class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver { |
| 39 public: | 39 public: |
| 40 ProfileSyncServiceObserverMock(); | 40 ProfileSyncServiceObserverMock(); |
| 41 virtual ~ProfileSyncServiceObserverMock(); | 41 virtual ~ProfileSyncServiceObserverMock(); |
| 42 | 42 |
| 43 MOCK_METHOD0(OnStateChanged, void()); | 43 MOCK_METHOD0(OnStateChanged, void()); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class ThreadNotificationService | |
| 47 : public base::RefCountedThreadSafe<ThreadNotificationService> { | |
| 48 public: | |
| 49 explicit ThreadNotificationService(base::Thread* notification_thread); | |
| 50 | |
| 51 void Init(); | |
| 52 void TearDown(); | |
| 53 | |
| 54 private: | |
| 55 friend class base::RefCountedThreadSafe<ThreadNotificationService>; | |
| 56 virtual ~ThreadNotificationService(); | |
| 57 | |
| 58 void InitTask(); | |
| 59 void TearDownTask(); | |
| 60 | |
| 61 base::WaitableEvent done_event_; | |
| 62 base::Thread* notification_thread_; | |
| 63 scoped_ptr<content::NotificationService> service_; | |
| 64 }; | |
| 65 | |
| 66 class ThreadNotifier : // NOLINT | 46 class ThreadNotifier : // NOLINT |
| 67 public base::RefCountedThreadSafe<ThreadNotifier> { | 47 public base::RefCountedThreadSafe<ThreadNotifier> { |
| 68 public: | 48 public: |
| 69 explicit ThreadNotifier(base::Thread* notify_thread); | 49 explicit ThreadNotifier(base::Thread* notify_thread); |
| 70 | 50 |
| 71 void Notify(int type, const content::NotificationDetails& details); | 51 void Notify(int type, const content::NotificationDetails& details); |
| 72 | 52 |
| 73 void Notify(int type, | 53 void Notify(int type, |
| 74 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
| 75 const content::NotificationDetails& details); | 55 const content::NotificationDetails& details); |
| 76 | 56 |
| 77 private: | 57 private: |
| 78 friend class base::RefCountedThreadSafe<ThreadNotifier>; | 58 friend class base::RefCountedThreadSafe<ThreadNotifier>; |
| 79 virtual ~ThreadNotifier(); | 59 virtual ~ThreadNotifier(); |
| 80 | 60 |
| 81 void NotifyTask(int type, | 61 void NotifyTask(int type, |
| 82 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
| 83 const content::NotificationDetails& details); | 63 const content::NotificationDetails& details); |
| 84 | 64 |
| 85 base::WaitableEvent done_event_; | 65 base::WaitableEvent done_event_; |
| 86 base::Thread* notify_thread_; | 66 base::Thread* notify_thread_; |
| 87 }; | 67 }; |
| 88 | 68 |
| 89 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 69 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
| OLD | NEW |