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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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) 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 <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/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 ACTION_P(AcquireSyncTransaction, password_test_service) { 72 ACTION_P(AcquireSyncTransaction, password_test_service) {
73 // Check to make sure we can aquire a transaction (will crash if a transaction 73 // Check to make sure we can aquire a transaction (will crash if a transaction
74 // is already held by this thread, deadlock if held by another thread). 74 // is already held by this thread, deadlock if held by another thread).
75 syncer::WriteTransaction trans( 75 syncer::WriteTransaction trans(
76 FROM_HERE, password_test_service->GetUserShare()); 76 FROM_HERE, password_test_service->GetUserShare());
77 DVLOG(1) << "Sync transaction acquired."; 77 DVLOG(1) << "Sync transaction acquired.";
78 } 78 }
79 79
80 static void QuitMessageLoop() { 80 static void QuitMessageLoop() {
81 MessageLoop::current()->Quit(); 81 base::MessageLoop::current()->Quit();
82 } 82 }
83 83
84 class NullPasswordStore : public MockPasswordStore { 84 class NullPasswordStore : public MockPasswordStore {
85 public: 85 public:
86 NullPasswordStore() {} 86 NullPasswordStore() {}
87 87
88 static scoped_refptr<RefcountedBrowserContextKeyedService> Build( 88 static scoped_refptr<RefcountedBrowserContextKeyedService> Build(
89 content::BrowserContext* profile) { 89 content::BrowserContext* profile) {
90 return scoped_refptr<RefcountedBrowserContextKeyedService>(); 90 return scoped_refptr<RefcountedBrowserContextKeyedService>();
91 } 91 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _)). 242 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _)).
243 WillOnce(ReturnNewDataTypeManager()); 243 WillOnce(ReturnNewDataTypeManager());
244 244
245 // We need tokens to get the tests going 245 // We need tokens to get the tests going
246 token_service_->IssueAuthTokenForTest( 246 token_service_->IssueAuthTokenForTest(
247 GaiaConstants::kSyncService, "token"); 247 GaiaConstants::kSyncService, "token");
248 248
249 sync_service_->RegisterDataTypeController(data_type_controller); 249 sync_service_->RegisterDataTypeController(data_type_controller);
250 sync_service_->Initialize(); 250 sync_service_->Initialize();
251 MessageLoop::current()->Run(); 251 base::MessageLoop::current()->Run();
252 FlushLastDBTask(); 252 FlushLastDBTask();
253 253
254 sync_service_->SetEncryptionPassphrase("foo", 254 sync_service_->SetEncryptionPassphrase("foo",
255 ProfileSyncService::IMPLICIT); 255 ProfileSyncService::IMPLICIT);
256 MessageLoop::current()->Run(); 256 base::MessageLoop::current()->Run();
257 } 257 }
258 } 258 }
259 259
260 // Helper to sort the results of GetPasswordEntriesFromSyncDB. The sorting 260 // Helper to sort the results of GetPasswordEntriesFromSyncDB. The sorting
261 // doesn't need to be particularly intelligent, it just needs to be consistent 261 // doesn't need to be particularly intelligent, it just needs to be consistent
262 // enough that we can base our tests expectations on the ordering it provides. 262 // enough that we can base our tests expectations on the ordering it provides.
263 static bool PasswordFormComparator(const PasswordForm& pf1, 263 static bool PasswordFormComparator(const PasswordForm& pf1,
264 const PasswordForm& pf2) { 264 const PasswordForm& pf2) {
265 if (pf1.submit_element < pf2.submit_element) 265 if (pf1.submit_element < pf2.submit_element)
266 return true; 266 return true;
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 CreateRootHelper create_root(this, syncer::PASSWORDS); 661 CreateRootHelper create_root(this, syncer::PASSWORDS);
662 StartSyncService(create_root.callback(), 662 StartSyncService(create_root.callback(),
663 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); 663 base::Bind(&AddPasswordEntriesCallback, this, sync_forms));
664 664
665 std::vector<PasswordForm> new_sync_forms; 665 std::vector<PasswordForm> new_sync_forms;
666 GetPasswordEntriesFromSyncDB(&new_sync_forms); 666 GetPasswordEntriesFromSyncDB(&new_sync_forms);
667 667
668 EXPECT_EQ(1U, new_sync_forms.size()); 668 EXPECT_EQ(1U, new_sync_forms.size());
669 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 669 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
670 } 670 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.cc ('k') | chrome/browser/sync/profile_sync_service_preference_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698