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

Side by Side Diff: chrome/browser/sync/glue/browser_thread_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/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // DoWork is called first. 67 // DoWork is called first.
68 void Timeout() { 68 void Timeout() {
69 ADD_FAILURE() << "Timed out waiting for work to be done on the DB thread."; 69 ADD_FAILURE() << "Timed out waiting for work to be done on the DB thread.";
70 BrowserThread::PostTask( 70 BrowserThread::PostTask(
71 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure()); 71 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure());
72 } 72 }
73 73
74 protected: 74 protected:
75 virtual void SetUp() { 75 virtual void SetUp() {
76 db_thread_.Start(); 76 db_thread_.Start();
77 worker_ = new DatabaseModelWorker(); 77 worker_ = new DatabaseModelWorker(NULL);
78 } 78 }
79 79
80 virtual void Teardown() { 80 virtual void Teardown() {
81 worker_ = NULL; 81 worker_ = NULL;
82 db_thread_.Stop(); 82 db_thread_.Stop();
83 } 83 }
84 84
85 private: 85 private:
86 bool did_do_work_; 86 bool did_do_work_;
87 scoped_refptr<BrowserThreadModelWorker> worker_; 87 scoped_refptr<BrowserThreadModelWorker> worker_;
(...skipping 10 matching lines...) Expand all
98 MessageLoop::current()->PostTask(FROM_HERE, 98 MessageLoop::current()->PostTask(FROM_HERE,
99 base::Bind(&SyncBrowserThreadModelWorkerTest::ScheduleWork, 99 base::Bind(&SyncBrowserThreadModelWorkerTest::ScheduleWork,
100 factory()->GetWeakPtr())); 100 factory()->GetWeakPtr()));
101 MessageLoop::current()->Run(); 101 MessageLoop::current()->Run();
102 EXPECT_TRUE(did_do_work()); 102 EXPECT_TRUE(did_do_work());
103 } 103 }
104 104
105 } // namespace 105 } // namespace
106 106
107 } // namespace browser_sync 107 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/browser_thread_model_worker.cc ('k') | chrome/browser/sync/glue/history_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698