OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 model_task_runner_(model_task_runner), | 80 model_task_runner_(model_task_runner), |
81 sync_task_runner_(sync_task_runner) {} | 81 sync_task_runner_(sync_task_runner) {} |
82 ~MockSyncContextProxy() override {} | 82 ~MockSyncContextProxy() override {} |
83 | 83 |
84 void ConnectTypeToSync( | 84 void ConnectTypeToSync( |
85 syncer::ModelType type, | 85 syncer::ModelType type, |
86 const syncer::DataTypeState& data_type_state, | 86 const syncer::DataTypeState& data_type_state, |
87 const syncer::UpdateResponseDataList& saved_pending_updates, | 87 const syncer::UpdateResponseDataList& saved_pending_updates, |
88 const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_proxy) | 88 const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_proxy) |
89 override { | 89 override { |
90 // Normally we'd use MessageLoopProxy::current() as the TaskRunner argument | 90 // Normally we'd use ThreadTaskRunnerHandle::Get() as the TaskRunner |
| 91 // argument |
91 // to Connect(). That won't work here in this test, so we use the | 92 // to Connect(). That won't work here in this test, so we use the |
92 // model_task_runner_ that was injected for this purpose instead. | 93 // model_task_runner_ that was injected for this purpose instead. |
93 sync_task_runner_->PostTask(FROM_HERE, | 94 sync_task_runner_->PostTask(FROM_HERE, |
94 base::Bind(&MockSyncContext::Connect, | 95 base::Bind(&MockSyncContext::Connect, |
95 base::Unretained(mock_sync_context_), | 96 base::Unretained(mock_sync_context_), |
96 type, | 97 type, |
97 model_task_runner_, | 98 model_task_runner_, |
98 type_proxy)); | 99 type_proxy)); |
99 } | 100 } |
100 | 101 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // disables sittin in its queue. Let's allow it to process them. | 432 // disables sittin in its queue. Let's allow it to process them. |
432 RunQueuedSyncThreadTasks(); | 433 RunQueuedSyncThreadTasks(); |
433 | 434 |
434 // Let the model thread process any messages from the sync thread. | 435 // Let the model thread process any messages from the sync thread. |
435 RunQueuedModelThreadTasks(); | 436 RunQueuedModelThreadTasks(); |
436 EXPECT_TRUE(type_sync_proxy_.IsPreferred()); | 437 EXPECT_TRUE(type_sync_proxy_.IsPreferred()); |
437 EXPECT_TRUE(type_sync_proxy_.IsConnected()); | 438 EXPECT_TRUE(type_sync_proxy_.IsConnected()); |
438 } | 439 } |
439 | 440 |
440 } // namespace sync_driver | 441 } // namespace sync_driver |
OLD | NEW |