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

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

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 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) 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 static void QuitMessageLoop() { 80 static void QuitMessageLoop() {
81 MessageLoop::current()->Quit(); 81 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<RefcountedProfileKeyedService> Build(Profile* profile) { 88 static scoped_refptr<RefcountedProfileKeyedService> Build(
89 content::BrowserContext* profile) {
89 return scoped_refptr<RefcountedProfileKeyedService>(); 90 return scoped_refptr<RefcountedProfileKeyedService>();
90 } 91 }
91 92
92 protected: 93 protected:
93 virtual ~NullPasswordStore() {} 94 virtual ~NullPasswordStore() {}
94 }; 95 };
95 96
96 class PasswordTestProfileSyncService : public TestProfileSyncService { 97 class PasswordTestProfileSyncService : public TestProfileSyncService {
97 public: 98 public:
98 PasswordTestProfileSyncService( 99 PasswordTestProfileSyncService(
(...skipping 22 matching lines...) Expand all
121 if (!callback_.is_null()) 122 if (!callback_.is_null())
122 callback_.Run(); 123 callback_.Run();
123 124
124 TestProfileSyncService::OnPassphraseAccepted(); 125 TestProfileSyncService::OnPassphraseAccepted();
125 } 126 }
126 127
127 virtual void OnConfigureBlocked() OVERRIDE { 128 virtual void OnConfigureBlocked() OVERRIDE {
128 QuitMessageLoop(); 129 QuitMessageLoop();
129 } 130 }
130 131
131 static ProfileKeyedService* Build(Profile* profile) { 132 static ProfileKeyedService* Build(content::BrowserContext* context) {
133 Profile* profile = static_cast<Profile*>(context);
132 SigninManagerBase* signin = 134 SigninManagerBase* signin =
133 SigninManagerFactory::GetForProfile(profile); 135 SigninManagerFactory::GetForProfile(profile);
134 ProfileSyncComponentsFactoryMock* factory = 136 ProfileSyncComponentsFactoryMock* factory =
135 new ProfileSyncComponentsFactoryMock(); 137 new ProfileSyncComponentsFactoryMock();
136 return new PasswordTestProfileSyncService(factory, profile, signin); 138 return new PasswordTestProfileSyncService(factory, profile, signin);
137 } 139 }
138 140
139 void set_passphrase_accept_callback(const base::Closure& callback) { 141 void set_passphrase_accept_callback(const base::Closure& callback) {
140 callback_ = callback; 142 callback_ = callback;
141 } 143 }
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 CreateRootHelper create_root(this, syncer::PASSWORDS); 661 CreateRootHelper create_root(this, syncer::PASSWORDS);
660 StartSyncService(create_root.callback(), 662 StartSyncService(create_root.callback(),
661 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); 663 base::Bind(&AddPasswordEntriesCallback, this, sync_forms));
662 664
663 std::vector<PasswordForm> new_sync_forms; 665 std::vector<PasswordForm> new_sync_forms;
664 GetPasswordEntriesFromSyncDB(&new_sync_forms); 666 GetPasswordEntriesFromSyncDB(&new_sync_forms);
665 667
666 EXPECT_EQ(1U, new_sync_forms.size()); 668 EXPECT_EQ(1U, new_sync_forms.size());
667 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 669 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
668 } 670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698