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

Side by Side Diff: components/sync/engine/model_safe_worker_unittest.cc

Issue 2942773002: Task Scheduler API migration: change BrowserThreadModelWorker to SequencedModelWorker (Closed)
Patch Set: Updated more comments to reflect thread -> sequence migration. Created 3 years, 6 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
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 "components/sync/engine/model_safe_worker.h" 5 #include "components/sync/engine/model_safe_worker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 20 matching lines...) Expand all
31 class MockModelSafeWorker : public ModelSafeWorker { 31 class MockModelSafeWorker : public ModelSafeWorker {
32 public: 32 public:
33 MockModelSafeWorker() = default; 33 MockModelSafeWorker() = default;
34 34
35 void ScheduleWork(base::OnceClosure work) override { 35 void ScheduleWork(base::OnceClosure work) override {
36 task_runner_->PostTask(FROM_HERE, std::move(work)); 36 task_runner_->PostTask(FROM_HERE, std::move(work));
37 } 37 }
38 38
39 ModelSafeGroup GetModelSafeGroup() override { return GROUP_PASSIVE; } 39 ModelSafeGroup GetModelSafeGroup() override { return GROUP_PASSIVE; }
40 40
41 bool IsOnModelThread() override { 41 bool IsOnModelSequence() override {
42 return task_runner_->BelongsToCurrentThread(); 42 return task_runner_->BelongsToCurrentThread();
43 } 43 }
44 44
45 scoped_refptr<base::TestSimpleTaskRunner> task_runner() const { 45 scoped_refptr<base::TestSimpleTaskRunner> task_runner() const {
46 return task_runner_; 46 return task_runner_;
47 } 47 }
48 48
49 private: 49 private:
50 friend class base::RefCountedThreadSafe<MockModelSafeWorker>; 50 friend class base::RefCountedThreadSafe<MockModelSafeWorker>;
51 51
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 while (!worker_->task_runner()->HasPendingTask()) 205 while (!worker_->task_runner()->HasPendingTask())
206 base::PlatformThread::YieldCurrentThread(); 206 base::PlatformThread::YieldCurrentThread();
207 worker_->task_runner()->RunUntilIdle(); 207 worker_->task_runner()->RunUntilIdle();
208 208
209 EXPECT_TRUE(did_work); 209 EXPECT_TRUE(did_work);
210 sync_thread_.Stop(); 210 sync_thread_.Stop();
211 EXPECT_TRUE(sync_thread_unblocked_.IsSet()); 211 EXPECT_TRUE(sync_thread_unblocked_.IsSet());
212 } 212 }
213 213
214 } // namespace syncer 214 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/model_safe_worker.h ('k') | components/sync/engine/passive_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698