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 #include "chrome/browser/sync/profile_sync_test_util.h" | 5 #include "chrome/browser/sync/profile_sync_test_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 | 9 |
10 using content::BrowserThread; | 10 using content::BrowserThread; |
11 | 11 |
12 SyncServiceObserverMock::SyncServiceObserverMock() { | 12 SyncServiceObserverMock::SyncServiceObserverMock() { |
13 } | 13 } |
14 | 14 |
15 SyncServiceObserverMock::~SyncServiceObserverMock() { | 15 SyncServiceObserverMock::~SyncServiceObserverMock() { |
16 } | 16 } |
17 | 17 |
18 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) | 18 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) |
19 : done_event_(false, false), | 19 : done_event_(false, false), |
20 notify_thread_(notify_thread) {} | 20 notify_thread_(notify_thread) {} |
21 | 21 |
22 void ThreadNotifier::Notify(int type, | 22 void ThreadNotifier::Notify(int type, |
23 const content::NotificationDetails& details) { | 23 const content::NotificationDetails& details) { |
24 Notify(type, content::NotificationService::AllSources(), details); | 24 Notify(type, content::NotificationService::AllSources(), details); |
25 } | 25 } |
26 | 26 |
27 void ThreadNotifier::Notify(int type, | 27 void ThreadNotifier::Notify(int type, |
28 const content::NotificationSource& source, | 28 const content::NotificationSource& source, |
29 const content::NotificationDetails& details) { | 29 const content::NotificationDetails& details) { |
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 30 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
31 notify_thread_->message_loop()->PostTask( | 31 notify_thread_->message_loop()->PostTask( |
32 FROM_HERE, | 32 FROM_HERE, |
33 base::Bind(&ThreadNotifier::NotifyTask, this, type, source, details)); | 33 base::Bind(&ThreadNotifier::NotifyTask, this, type, source, details)); |
34 done_event_.Wait(); | 34 done_event_.Wait(); |
35 } | 35 } |
36 | 36 |
37 ThreadNotifier::~ThreadNotifier() {} | 37 ThreadNotifier::~ThreadNotifier() {} |
38 | 38 |
39 void ThreadNotifier::NotifyTask(int type, | 39 void ThreadNotifier::NotifyTask(int type, |
40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
41 const content::NotificationDetails& details) { | 41 const content::NotificationDetails& details) { |
42 content::NotificationService::current()->Notify(type, source, details); | 42 content::NotificationService::current()->Notify(type, source, details); |
43 done_event_.Signal(); | 43 done_event_.Signal(); |
44 } | 44 } |
OLD | NEW |