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

Side by Side Diff: chrome/browser/sync/profile_sync_service_password_unittest.cc

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copy paste :( Created 9 years, 8 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 | 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 <vector> 5 #include <vector>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 done.TimedWait(base::TimeDelta::FromMilliseconds( 177 done.TimedWait(base::TimeDelta::FromMilliseconds(
178 TestTimeouts::action_timeout_ms())); 178 TestTimeouts::action_timeout_ms()));
179 } 179 }
180 180
181 void StartSyncService(Task* root_task, Task* node_task) { 181 void StartSyncService(Task* root_task, Task* node_task) {
182 if (!service_.get()) { 182 if (!service_.get()) {
183 service_.reset(new PasswordTestProfileSyncService( 183 service_.reset(new PasswordTestProfileSyncService(
184 &factory_, &profile_, "test_user", false, root_task, node_task)); 184 &factory_, &profile_, "test_user", false, root_task, node_task));
185 service_->RegisterPreferences(); 185 service_->RegisterPreferences();
186 profile_.GetPrefs()->SetBoolean(prefs::kSyncPasswords, true); 186 profile_.GetPrefs()->SetBoolean(prefs::kSyncPasswords, true);
187 EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
188 Return(service_.get()));
187 PasswordDataTypeController* data_type_controller = 189 PasswordDataTypeController* data_type_controller =
188 new PasswordDataTypeController(&factory_, 190 new PasswordDataTypeController(&factory_,
189 &profile_, 191 &profile_);
190 service_.get());
191 192
192 EXPECT_CALL(factory_, CreatePasswordSyncComponents(_, _, _)). 193 EXPECT_CALL(factory_, CreatePasswordSyncComponents(_, _, _)).
193 Times(AtLeast(1)). // Can be more if we hit NEEDS_CRYPTO. 194 Times(AtLeast(1)). // Can be more if we hit NEEDS_CRYPTO.
194 WillRepeatedly(MakePasswordSyncComponents(service_.get(), 195 WillRepeatedly(MakePasswordSyncComponents(service_.get(),
195 password_store_.get(), 196 password_store_.get(),
196 data_type_controller)); 197 data_type_controller));
197 EXPECT_CALL(factory_, CreateDataTypeManager(_, _)). 198 EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).
198 WillOnce(ReturnNewDataTypeManager()); 199 WillOnce(ReturnNewDataTypeManager());
199 200
200 // We need tokens to get the tests going 201 // We need tokens to get the tests going
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 AddPasswordEntriesTask node_task(this, sync_forms); 536 AddPasswordEntriesTask node_task(this, sync_forms);
536 537
537 StartSyncService(&root_task, &node_task); 538 StartSyncService(&root_task, &node_task);
538 539
539 std::vector<PasswordForm> new_sync_forms; 540 std::vector<PasswordForm> new_sync_forms;
540 GetPasswordEntriesFromSyncDB(&new_sync_forms); 541 GetPasswordEntriesFromSyncDB(&new_sync_forms);
541 542
542 EXPECT_EQ(1U, new_sync_forms.size()); 543 EXPECT_EQ(1U, new_sync_forms.size());
543 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 544 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
544 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698