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

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

Issue 8536037: base::Bind: Low-hanging fruit conversions of NewRunnableFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix 4. Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/auto_login_prompter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h"
9 #include "base/location.h" 10 #include "base/location.h"
10 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
11 #include "base/task.h" 12 #include "base/task.h"
12 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
13 #include "base/time.h" 14 #include "base/time.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/password_manager/password_store.h" 16 #include "chrome/browser/password_manager/password_store.h"
16 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 18 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
18 #include "chrome/browser/sync/glue/password_change_processor.h" 19 #include "chrome/browser/sync/glue/password_change_processor.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 profile_.ResetRequestContext(); 181 profile_.ResetRequestContext();
181 AbstractProfileSyncServiceTest::TearDown(); 182 AbstractProfileSyncServiceTest::TearDown();
182 } 183 }
183 184
184 static void SignalEvent(base::WaitableEvent* done) { 185 static void SignalEvent(base::WaitableEvent* done) {
185 done->Signal(); 186 done->Signal();
186 } 187 }
187 188
188 void FlushLastDBTask() { 189 void FlushLastDBTask() {
189 base::WaitableEvent done(false, false); 190 base::WaitableEvent done(false, false);
190 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 191 BrowserThread::PostTask(
191 NewRunnableFunction(&ProfileSyncServicePasswordTest::SignalEvent, 192 BrowserThread::DB, FROM_HERE,
192 &done)); 193 base::Bind(&ProfileSyncServicePasswordTest::SignalEvent, &done));
193 done.TimedWait(base::TimeDelta::FromMilliseconds( 194 done.TimedWait(base::TimeDelta::FromMilliseconds(
194 TestTimeouts::action_timeout_ms())); 195 TestTimeouts::action_timeout_ms()));
195 } 196 }
196 197
197 void StartSyncService(Task* root_task, Task* node_task) { 198 void StartSyncService(Task* root_task, Task* node_task) {
198 if (!service_.get()) { 199 if (!service_.get()) {
199 service_.reset(new PasswordTestProfileSyncService( 200 service_.reset(new PasswordTestProfileSyncService(
200 &factory_, &profile_, "test_user", false, root_task, node_task)); 201 &factory_, &profile_, "test_user", false, root_task, node_task));
201 syncable::ModelTypeSet preferred_types; 202 syncable::ModelTypeSet preferred_types;
202 service_->GetPreferredDataTypes(&preferred_types); 203 service_->GetPreferredDataTypes(&preferred_types);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 AddPasswordEntriesTask node_task(this, sync_forms); 620 AddPasswordEntriesTask node_task(this, sync_forms);
620 621
621 StartSyncService(&root_task, &node_task); 622 StartSyncService(&root_task, &node_task);
622 623
623 std::vector<PasswordForm> new_sync_forms; 624 std::vector<PasswordForm> new_sync_forms;
624 GetPasswordEntriesFromSyncDB(&new_sync_forms); 625 GetPasswordEntriesFromSyncDB(&new_sync_forms);
625 626
626 EXPECT_EQ(1U, new_sync_forms.size()); 627 EXPECT_EQ(1U, new_sync_forms.size());
627 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 628 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
628 } 629 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/auto_login_prompter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698