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 "chrome/browser/sync/abstract_profile_sync_service_test.h" | 5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "chrome/browser/sync/test_profile_sync_service.h" | 10 #include "chrome/browser/sync/test_profile_sync_service.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void AbstractProfileSyncServiceTest::TearDown() { | 110 void AbstractProfileSyncServiceTest::TearDown() { |
111 // Pump messages posted by the sync core thread (which may end up | 111 // Pump messages posted by the sync core thread (which may end up |
112 // posting on the IO thread). | 112 // posting on the IO thread). |
113 ui_loop_.RunAllPending(); | 113 ui_loop_.RunAllPending(); |
114 io_thread_.Stop(); | 114 io_thread_.Stop(); |
115 file_thread_.Stop(); | 115 file_thread_.Stop(); |
116 db_thread_.Stop(); | 116 db_thread_.Stop(); |
117 ui_loop_.RunAllPending(); | 117 ui_loop_.RunAllPending(); |
118 } | 118 } |
119 | 119 |
120 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) { | 120 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type, |
| 121 UserShare* user_share) { |
121 return ProfileSyncServiceTestHelper::CreateRoot( | 122 return ProfileSyncServiceTestHelper::CreateRoot( |
122 model_type, | 123 model_type, |
123 service_->GetUserShare(), | 124 user_share, |
124 service_->id_factory()); | 125 service_->id_factory()); |
125 } | 126 } |
126 | 127 |
127 // static | 128 // static |
128 ProfileKeyedService* AbstractProfileSyncServiceTest::BuildTokenService( | 129 ProfileKeyedService* AbstractProfileSyncServiceTest::BuildTokenService( |
129 Profile* profile) { | 130 Profile* profile) { |
130 return new TokenService; | 131 return new TokenService; |
131 } | 132 } |
132 | 133 |
133 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test, | 134 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test, |
134 ModelType model_type) | 135 ModelType model_type) |
135 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_( | 136 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_( |
136 base::Bind(&CreateRootHelper::CreateRootCallback, | 137 base::Bind(&CreateRootHelper::CreateRootCallback, |
137 base::Unretained(this)))), | 138 base::Unretained(this)))), |
138 test_(test), | 139 test_(test), |
139 model_type_(model_type), | 140 model_type_(model_type), |
140 success_(false) { | 141 success_(false) { |
141 } | 142 } |
142 | 143 |
143 CreateRootHelper::~CreateRootHelper() { | 144 CreateRootHelper::~CreateRootHelper() { |
144 } | 145 } |
145 | 146 |
146 const base::Closure& CreateRootHelper::callback() const { | 147 const base::Callback<void(UserShare*)>& CreateRootHelper::callback() const { |
147 return callback_; | 148 return callback_; |
148 } | 149 } |
149 | 150 |
150 bool CreateRootHelper::success() { | 151 bool CreateRootHelper::success() { |
151 return success_; | 152 return success_; |
152 } | 153 } |
153 | 154 |
154 void CreateRootHelper::CreateRootCallback() { | 155 void CreateRootHelper::CreateRootCallback(UserShare* user_share) { |
155 success_ = test_->CreateRoot(model_type_); | 156 success_ = test_->CreateRoot(model_type_, user_share); |
156 } | 157 } |
OLD | NEW |