| 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/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
| 17 #include "content/common/content_notification_types.h" |
| 17 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 18 #include "content/common/notification_source.h" | 19 #include "content/common/notification_source.h" |
| 19 #include "content/common/notification_type.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 NotificationService::current()->Notify(type, |
| 28 NotificationService::AllSources(), | 28 NotificationService::AllSources(), |
| 29 NotificationService::NoDetails()); | 29 NotificationService::NoDetails()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 60 base::WaitableEvent done_event_; | 60 base::WaitableEvent done_event_; |
| 61 base::Thread* notification_thread_; | 61 base::Thread* notification_thread_; |
| 62 scoped_ptr<NotificationService> service_; | 62 scoped_ptr<NotificationService> service_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class ThreadNotifier : // NOLINT | 65 class ThreadNotifier : // NOLINT |
| 66 public base::RefCountedThreadSafe<ThreadNotifier> { | 66 public base::RefCountedThreadSafe<ThreadNotifier> { |
| 67 public: | 67 public: |
| 68 explicit ThreadNotifier(base::Thread* notify_thread); | 68 explicit ThreadNotifier(base::Thread* notify_thread); |
| 69 | 69 |
| 70 void Notify(NotificationType type, const NotificationDetails& details); | 70 void Notify(int type, const NotificationDetails& details); |
| 71 | 71 |
| 72 void Notify(NotificationType type, | 72 void Notify(int type, |
| 73 const NotificationSource& source, | 73 const NotificationSource& source, |
| 74 const NotificationDetails& details); | 74 const NotificationDetails& details); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class base::RefCountedThreadSafe<ThreadNotifier>; | 77 friend class base::RefCountedThreadSafe<ThreadNotifier>; |
| 78 virtual ~ThreadNotifier(); | 78 virtual ~ThreadNotifier(); |
| 79 | 79 |
| 80 void NotifyTask(NotificationType type, | 80 void NotifyTask(int type, |
| 81 const NotificationSource& source, | 81 const NotificationSource& source, |
| 82 const NotificationDetails& details); | 82 const NotificationDetails& details); |
| 83 | 83 |
| 84 base::WaitableEvent done_event_; | 84 base::WaitableEvent done_event_; |
| 85 base::Thread* notify_thread_; | 85 base::Thread* notify_thread_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ | 88 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_TEST_UTIL_H_ |
| OLD | NEW |