Index: chrome/browser/sync/profile_sync_test_util.h |
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h |
index 45f6046555c783b65697f9fd16562c70bb0c91f5..b7d7aa2f4f1ed16507cad456759aa10b9a8fd8b3 100644 |
--- a/chrome/browser/sync/profile_sync_test_util.h |
+++ b/chrome/browser/sync/profile_sync_test_util.h |
@@ -8,34 +8,21 @@ |
#include <string> |
-#include "base/logging.h" |
#include "base/message_loop.h" |
#include "base/ref_counted.h" |
#include "base/scoped_ptr.h" |
-#include "base/task.h" |
-#include "base/threading/thread.h" |
#include "base/synchronization/waitable_event.h" |
-#include "base/utf_string_conversions.h" |
#include "chrome/browser/browser_thread.h" |
-#include "chrome/browser/webdata/web_database.h" |
-#include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
-#include "chrome/browser/sync/glue/bookmark_change_processor.h" |
-#include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
-#include "chrome/browser/sync/glue/bookmark_model_associator.h" |
-#include "chrome/browser/sync/glue/change_processor.h" |
-#include "chrome/browser/sync/glue/data_type_manager_impl.h" |
-#include "chrome/browser/sync/glue/sync_backend_host.h" |
-#include "chrome/browser/sync/profile_sync_factory.h" |
-#include "chrome/browser/sync/profile_sync_service.h" |
-#include "chrome/browser/sync/syncable/model_type.h" |
-#include "chrome/browser/sync/unrecoverable_error_handler.h" |
-#include "chrome/common/notification_details.h" |
+#include "chrome/browser/sync/profile_sync_service_observer.h" |
#include "chrome/common/notification_service.h" |
#include "chrome/common/notification_source.h" |
#include "chrome/common/notification_type.h" |
-#include "chrome/test/sync/test_http_bridge_factory.h" |
#include "testing/gmock/include/gmock/gmock.h" |
+namespace base { |
+class Thread; |
+} |
+ |
ACTION_P(Notify, type) { |
NotificationService::current()->Notify(type, |
NotificationService::AllSources(), |
@@ -49,45 +36,26 @@ ACTION(QuitUIMessageLoop) { |
class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver { |
public: |
+ ProfileSyncServiceObserverMock(); |
+ virtual ~ProfileSyncServiceObserverMock(); |
+ |
MOCK_METHOD0(OnStateChanged, void()); |
}; |
class ThreadNotificationService |
: public base::RefCountedThreadSafe<ThreadNotificationService> { |
public: |
- explicit ThreadNotificationService(base::Thread* notification_thread) |
- : done_event_(false, false), |
- notification_thread_(notification_thread) {} |
- |
- void Init() { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- notification_thread_->message_loop()->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, &ThreadNotificationService::InitTask)); |
- done_event_.Wait(); |
- } |
- |
- void TearDown() { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- notification_thread_->message_loop()->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, |
- &ThreadNotificationService::TearDownTask)); |
- done_event_.Wait(); |
- } |
+ explicit ThreadNotificationService(base::Thread* notification_thread); |
+ |
+ void Init(); |
+ void TearDown(); |
private: |
friend class base::RefCountedThreadSafe<ThreadNotificationService>; |
+ virtual ~ThreadNotificationService(); |
- void InitTask() { |
- service_.reset(new NotificationService()); |
- done_event_.Signal(); |
- } |
- |
- void TearDownTask() { |
- service_.reset(NULL); |
- done_event_.Signal(); |
- } |
+ void InitTask(); |
+ void TearDownTask(); |
base::WaitableEvent done_event_; |
base::Thread* notification_thread_; |
@@ -97,37 +65,21 @@ class ThreadNotificationService |
class ThreadNotifier : // NOLINT |
public base::RefCountedThreadSafe<ThreadNotifier> { |
public: |
- explicit ThreadNotifier(base::Thread* notify_thread) |
- : done_event_(false, false), |
- notify_thread_(notify_thread) {} |
+ explicit ThreadNotifier(base::Thread* notify_thread); |
- void Notify(NotificationType type, const NotificationDetails& details) { |
- Notify(type, NotificationService::AllSources(), details); |
- } |
+ void Notify(NotificationType type, const NotificationDetails& details); |
void Notify(NotificationType type, |
const NotificationSource& source, |
- const NotificationDetails& details) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- notify_thread_->message_loop()->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, |
- &ThreadNotifier::NotifyTask, |
- type, |
- source, |
- details)); |
- done_event_.Wait(); |
- } |
+ const NotificationDetails& details); |
private: |
friend class base::RefCountedThreadSafe<ThreadNotifier>; |
+ virtual ~ThreadNotifier(); |
void NotifyTask(NotificationType type, |
const NotificationSource& source, |
- const NotificationDetails& details) { |
- NotificationService::current()->Notify(type, source, details); |
- done_event_.Signal(); |
- } |
+ const NotificationDetails& details); |
base::WaitableEvent done_event_; |
base::Thread* notify_thread_; |