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
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/profile_sync_test_util.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h"
12 using content::BrowserThread
;
14 SyncServiceObserverMock::SyncServiceObserverMock() {
17 SyncServiceObserverMock::~SyncServiceObserverMock() {
20 ThreadNotifier::ThreadNotifier(base::Thread
* notify_thread
)
21 : done_event_(false, false),
22 notify_thread_(notify_thread
) {}
24 void ThreadNotifier::Notify(int type
,
25 const content::NotificationDetails
& details
) {
26 Notify(type
, content::NotificationService::AllSources(), details
);
29 void ThreadNotifier::Notify(int type
,
30 const content::NotificationSource
& source
,
31 const content::NotificationDetails
& details
) {
32 DCHECK_CURRENTLY_ON(BrowserThread::UI
);
33 notify_thread_
->task_runner()->PostTask(
35 base::Bind(&ThreadNotifier::NotifyTask
, this, type
, source
, details
));
39 ThreadNotifier::~ThreadNotifier() {}
41 void ThreadNotifier::NotifyTask(int type
,
42 const content::NotificationSource
& source
,
43 const content::NotificationDetails
& details
) {
44 content::NotificationService::current()->Notify(type
, source
, details
);