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

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

Issue 6874018: make new syncer thread the default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Send for CR. 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 profile_.CreateRequestContext(); 146 profile_.CreateRequestContext();
147 password_store_ = new MockPasswordStore(); 147 password_store_ = new MockPasswordStore();
148 db_thread_.Start(); 148 db_thread_.Start();
149 149
150 notification_service_ = new ThreadNotificationService(&db_thread_); 150 notification_service_ = new ThreadNotificationService(&db_thread_);
151 notification_service_->Init(); 151 notification_service_->Init();
152 registrar_.Add(&observer_, 152 registrar_.Add(&observer_,
153 NotificationType::SYNC_CONFIGURE_DONE, 153 NotificationType::SYNC_CONFIGURE_DONE,
154 NotificationService::AllSources()); 154 NotificationService::AllSources());
155 registrar_.Add(&observer_, 155 registrar_.Add(&observer_,
156 NotificationType::SYNC_PAUSED, 156 NotificationType::SYNC_CONFIGURE_UPDATES_DOWNLOADED,
157 NotificationService::AllSources()); 157 NotificationService::AllSources());
158 } 158 }
159 159
160 virtual void TearDown() { 160 virtual void TearDown() {
161 service_.reset(); 161 service_.reset();
162 notification_service_->TearDown(); 162 notification_service_->TearDown();
163 db_thread_.Stop(); 163 db_thread_.Stop();
164 { 164 {
165 // The request context gets deleted on the I/O thread. To prevent a leak 165 // The request context gets deleted on the I/O thread. To prevent a leak
166 // supply one here. 166 // supply one here.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 EXPECT_CALL(profile_, GetPasswordStore(_)). 212 EXPECT_CALL(profile_, GetPasswordStore(_)).
213 Times(AtLeast(2)). // Can be more if we hit NEEDS_CRYPTO. 213 Times(AtLeast(2)). // Can be more if we hit NEEDS_CRYPTO.
214 WillRepeatedly(Return(password_store_.get())); 214 WillRepeatedly(Return(password_store_.get()));
215 215
216 EXPECT_CALL(observer_, 216 EXPECT_CALL(observer_,
217 Observe( 217 Observe(
218 NotificationType(NotificationType::SYNC_CONFIGURE_DONE),_,_)); 218 NotificationType(NotificationType::SYNC_CONFIGURE_DONE),_,_));
219 EXPECT_CALL(observer_, 219 EXPECT_CALL(observer_,
220 Observe( 220 Observe(
221 NotificationType(NotificationType::SYNC_PAUSED),_,_)) 221 NotificationType(
222 NotificationType::SYNC_CONFIGURE_UPDATES_DOWNLOADED),_,_))
tim (not reviewing) 2011/04/18 16:11:47 This was the kind of thing I expected to arise whe
lipalani1 2011/04/18 20:36:41 ha ha! yes and it took a while to figure out as we
223 .Times(2)
222 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); 224 .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
223 225
224 service_->RegisterDataTypeController(data_type_controller); 226 service_->RegisterDataTypeController(data_type_controller);
225 service_->Initialize(); 227 service_->Initialize();
226 MessageLoop::current()->Run(); 228 MessageLoop::current()->Run();
227 FlushLastDBTask(); 229 FlushLastDBTask();
228 230
229 service_->SetPassphrase("foo", false, true); 231 service_->SetPassphrase("foo", false, true);
230 MessageLoop::current()->Run(); 232 MessageLoop::current()->Run();
231 } 233 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 AddPasswordEntriesTask node_task(this, sync_forms); 542 AddPasswordEntriesTask node_task(this, sync_forms);
541 543
542 StartSyncService(&root_task, &node_task); 544 StartSyncService(&root_task, &node_task);
543 545
544 std::vector<PasswordForm> new_sync_forms; 546 std::vector<PasswordForm> new_sync_forms;
545 GetPasswordEntriesFromSyncDB(&new_sync_forms); 547 GetPasswordEntriesFromSyncDB(&new_sync_forms);
546 548
547 EXPECT_EQ(1U, new_sync_forms.size()); 549 EXPECT_EQ(1U, new_sync_forms.size());
548 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 550 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
549 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698