Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/sync/glue/ui_model_worker_unittest.cc

Issue 14046031: Worker changes to prepare for lock-free shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/ui_model_worker.cc ('k') | sync/internal_api/internal_components_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698