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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |