OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 class SyncUIModelWorkerTest : public testing::Test { | 83 class SyncUIModelWorkerTest : public testing::Test { |
84 public: | 84 public: |
85 SyncUIModelWorkerTest() : faux_syncer_thread_("FauxSyncerThread"), | 85 SyncUIModelWorkerTest() : faux_syncer_thread_("FauxSyncerThread"), |
86 faux_core_thread_("FauxCoreThread") { } | 86 faux_core_thread_("FauxCoreThread") { } |
87 | 87 |
88 virtual void SetUp() { | 88 virtual void SetUp() { |
89 faux_syncer_thread_.Start(); | 89 faux_syncer_thread_.Start(); |
90 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, | 90 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, |
91 &faux_ui_loop_)); | 91 &faux_ui_loop_)); |
92 bmw_ = new UIModelWorker(); | 92 bmw_ = new UIModelWorker(NULL); |
93 syncer_.reset(new Syncer(bmw_.get())); | 93 syncer_.reset(new Syncer(bmw_.get())); |
94 } | 94 } |
95 | 95 |
96 Syncer* syncer() { return syncer_.get(); } | 96 Syncer* syncer() { return syncer_.get(); } |
97 UIModelWorker* bmw() { return bmw_.get(); } | 97 UIModelWorker* bmw() { return bmw_.get(); } |
98 base::Thread* core_thread() { return &faux_core_thread_; } | 98 base::Thread* core_thread() { return &faux_core_thread_; } |
99 base::Thread* syncer_thread() { return &faux_syncer_thread_; } | 99 base::Thread* syncer_thread() { return &faux_syncer_thread_; } |
100 private: | 100 private: |
101 MessageLoop faux_ui_loop_; | 101 MessageLoop faux_ui_loop_; |
102 scoped_ptr<content::TestBrowserThread> ui_thread_; | 102 scoped_ptr<content::TestBrowserThread> ui_thread_; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 // This is what gets the UI thread blocked until NotifyExitRequested, | 204 // This is what gets the UI thread blocked until NotifyExitRequested, |
205 // which is called when FakeSyncapiShutdownCallback runs and deletes the | 205 // which is called when FakeSyncapiShutdownCallback runs and deletes the |
206 // syncer. | 206 // syncer. |
207 bmw()->Stop(); | 207 bmw()->Stop(); |
208 | 208 |
209 // Was the thread killed? | 209 // Was the thread killed? |
210 EXPECT_FALSE(syncer_thread()->IsRunning()); | 210 EXPECT_FALSE(syncer_thread()->IsRunning()); |
211 core_thread()->Stop(); | 211 core_thread()->Stop(); |
212 } | 212 } |
OLD | NEW |