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

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

Issue 8873032: Removing MessageLoop::QuitTask() from chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert 3 more problematic files Created 9 years 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) 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 "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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 this, 50 this,
51 &BrowserThreadModelWorkerTest::Timeout); 51 &BrowserThreadModelWorkerTest::Timeout);
52 worker()->DoWorkAndWaitUntilDone(c); 52 worker()->DoWorkAndWaitUntilDone(c);
53 } 53 }
54 54
55 // This is the work that will be scheduled to be done on the DB thread. 55 // This is the work that will be scheduled to be done on the DB thread.
56 UnrecoverableErrorInfo DoWork() { 56 UnrecoverableErrorInfo DoWork() {
57 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); 57 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
58 timer_.Stop(); // Stop the failure timer so the test succeeds. 58 timer_.Stop(); // Stop the failure timer so the test succeeds.
59 BrowserThread::PostTask( 59 BrowserThread::PostTask(
60 BrowserThread::IO, FROM_HERE, new MessageLoop::QuitTask()); 60 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure());
61 did_do_work_ = true; 61 did_do_work_ = true;
62 return UnrecoverableErrorInfo(); 62 return UnrecoverableErrorInfo();
63 } 63 }
64 64
65 // This will be called by the OneShotTimer and make the test fail unless 65 // This will be called by the OneShotTimer and make the test fail unless
66 // DoWork is called first. 66 // DoWork is called first.
67 void Timeout() { 67 void Timeout() {
68 ADD_FAILURE() << "Timed out waiting for work to be done on the DB thread."; 68 ADD_FAILURE() << "Timed out waiting for work to be done on the DB thread.";
69 BrowserThread::PostTask( 69 BrowserThread::PostTask(
70 BrowserThread::IO, FROM_HERE, new MessageLoop::QuitTask()); 70 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure());
71 } 71 }
72 72
73 protected: 73 protected:
74 virtual void SetUp() { 74 virtual void SetUp() {
75 db_thread_.Start(); 75 db_thread_.Start();
76 worker_ = new DatabaseModelWorker(); 76 worker_ = new DatabaseModelWorker();
77 } 77 }
78 78
79 virtual void Teardown() { 79 virtual void Teardown() {
80 worker_.release(); 80 worker_.release();
(...skipping 15 matching lines...) Expand all
96 TEST_F(BrowserThreadModelWorkerTest, DoesWorkOnDatabaseThread) { 96 TEST_F(BrowserThreadModelWorkerTest, DoesWorkOnDatabaseThread) {
97 MessageLoop::current()->PostTask(FROM_HERE, factory()->NewRunnableMethod( 97 MessageLoop::current()->PostTask(FROM_HERE, factory()->NewRunnableMethod(
98 &BrowserThreadModelWorkerTest::ScheduleWork)); 98 &BrowserThreadModelWorkerTest::ScheduleWork));
99 MessageLoop::current()->Run(); 99 MessageLoop::current()->Run();
100 EXPECT_TRUE(did_do_work()); 100 EXPECT_TRUE(did_do_work());
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 } // namespace browser_sync 105 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698