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/task.h" | 7 #include "base/task.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 | 9 |
10 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} | 10 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} |
(...skipping 18 matching lines...) Expand all Loading... |
29 notification_thread_->message_loop()->PostTask( | 29 notification_thread_->message_loop()->PostTask( |
30 FROM_HERE, | 30 FROM_HERE, |
31 NewRunnableMethod(this, | 31 NewRunnableMethod(this, |
32 &ThreadNotificationService::TearDownTask)); | 32 &ThreadNotificationService::TearDownTask)); |
33 done_event_.Wait(); | 33 done_event_.Wait(); |
34 } | 34 } |
35 | 35 |
36 ThreadNotificationService::~ThreadNotificationService() {} | 36 ThreadNotificationService::~ThreadNotificationService() {} |
37 | 37 |
38 void ThreadNotificationService::InitTask() { | 38 void ThreadNotificationService::InitTask() { |
39 service_.reset(new NotificationService()); | 39 service_.reset(new NotificationServiceImpl()); |
40 done_event_.Signal(); | 40 done_event_.Signal(); |
41 } | 41 } |
42 | 42 |
43 void ThreadNotificationService::TearDownTask() { | 43 void ThreadNotificationService::TearDownTask() { |
44 service_.reset(NULL); | 44 service_.reset(NULL); |
45 done_event_.Signal(); | 45 done_event_.Signal(); |
46 } | 46 } |
47 | 47 |
48 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) | 48 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) |
49 : done_event_(false, false), | 49 : done_event_(false, false), |
50 notify_thread_(notify_thread) {} | 50 notify_thread_(notify_thread) {} |
51 | 51 |
52 void ThreadNotifier::Notify(int type, | 52 void ThreadNotifier::Notify(int type, |
53 const content::NotificationDetails& details) { | 53 const content::NotificationDetails& details) { |
54 Notify(type, NotificationService::AllSources(), details); | 54 Notify(type, content::NotificationService::AllSources(), details); |
55 } | 55 } |
56 | 56 |
57 void ThreadNotifier::Notify(int type, | 57 void ThreadNotifier::Notify(int type, |
58 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
59 const content::NotificationDetails& details) { | 59 const content::NotificationDetails& details) { |
60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
61 notify_thread_->message_loop()->PostTask( | 61 notify_thread_->message_loop()->PostTask( |
62 FROM_HERE, | 62 FROM_HERE, |
63 NewRunnableMethod(this, | 63 NewRunnableMethod(this, |
64 &ThreadNotifier::NotifyTask, | 64 &ThreadNotifier::NotifyTask, |
65 type, | 65 type, |
66 source, | 66 source, |
67 details)); | 67 details)); |
68 done_event_.Wait(); | 68 done_event_.Wait(); |
69 } | 69 } |
70 | 70 |
71 ThreadNotifier::~ThreadNotifier() {} | 71 ThreadNotifier::~ThreadNotifier() {} |
72 | 72 |
73 void ThreadNotifier::NotifyTask(int type, | 73 void ThreadNotifier::NotifyTask(int type, |
74 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
75 const content::NotificationDetails& details) { | 75 const content::NotificationDetails& details) { |
76 NotificationService::current()->Notify(type, source, details); | 76 content::NotificationService::current()->Notify(type, source, details); |
77 done_event_.Signal(); | 77 done_event_.Signal(); |
78 } | 78 } |
OLD | NEW |