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

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

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deal with new enterprise_platform_keys_private_api 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 protected: 92 protected:
93 virtual ~NullPasswordStore() {} 93 virtual ~NullPasswordStore() {}
94 }; 94 };
95 95
96 class PasswordTestProfileSyncService : public TestProfileSyncService { 96 class PasswordTestProfileSyncService : public TestProfileSyncService {
97 public: 97 public:
98 PasswordTestProfileSyncService( 98 PasswordTestProfileSyncService(
99 ProfileSyncComponentsFactory* factory, 99 ProfileSyncComponentsFactory* factory,
100 Profile* profile, 100 Profile* profile,
101 SigninManager* signin) 101 SigninManagerBase* signin)
102 : TestProfileSyncService(factory, 102 : TestProfileSyncService(factory,
103 profile, 103 profile,
104 signin, 104 signin,
105 ProfileSyncService::AUTO_START, 105 ProfileSyncService::AUTO_START,
106 false) {} 106 false) {}
107 107
108 virtual ~PasswordTestProfileSyncService() {} 108 virtual ~PasswordTestProfileSyncService() {}
109 109
110 virtual void OnPassphraseRequired( 110 virtual void OnPassphraseRequired(
111 syncer::PassphraseRequiredReason reason, 111 syncer::PassphraseRequiredReason reason,
(...skipping 10 matching lines...) Expand all
122 callback_.Run(); 122 callback_.Run();
123 123
124 TestProfileSyncService::OnPassphraseAccepted(); 124 TestProfileSyncService::OnPassphraseAccepted();
125 } 125 }
126 126
127 virtual void OnConfigureBlocked() OVERRIDE { 127 virtual void OnConfigureBlocked() OVERRIDE {
128 QuitMessageLoop(); 128 QuitMessageLoop();
129 } 129 }
130 130
131 static ProfileKeyedService* Build(Profile* profile) { 131 static ProfileKeyedService* Build(Profile* profile) {
132 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); 132 SigninManagerBase* signin =
133 SigninManagerFactory::GetForProfile(profile);
133 ProfileSyncComponentsFactoryMock* factory = 134 ProfileSyncComponentsFactoryMock* factory =
134 new ProfileSyncComponentsFactoryMock(); 135 new ProfileSyncComponentsFactoryMock();
135 return new PasswordTestProfileSyncService(factory, profile, signin); 136 return new PasswordTestProfileSyncService(factory, profile, signin);
136 } 137 }
137 138
138 void set_passphrase_accept_callback(const base::Closure& callback) { 139 void set_passphrase_accept_callback(const base::Closure& callback) {
139 callback_ = callback; 140 callback_ = callback;
140 } 141 }
141 142
142 private: 143 private:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 base::WaitableEvent done(false, false); 192 base::WaitableEvent done(false, false);
192 BrowserThread::PostTask( 193 BrowserThread::PostTask(
193 BrowserThread::DB, FROM_HERE, 194 BrowserThread::DB, FROM_HERE,
194 base::Bind(&ProfileSyncServicePasswordTest::SignalEvent, &done)); 195 base::Bind(&ProfileSyncServicePasswordTest::SignalEvent, &done));
195 done.TimedWait(TestTimeouts::action_timeout()); 196 done.TimedWait(TestTimeouts::action_timeout());
196 } 197 }
197 198
198 void StartSyncService(const base::Closure& root_callback, 199 void StartSyncService(const base::Closure& root_callback,
199 const base::Closure& node_callback) { 200 const base::Closure& node_callback) {
200 if (!sync_service_) { 201 if (!sync_service_) {
201 SigninManager* signin = SigninManagerFactory::GetForProfile(&profile_); 202 SigninManagerBase* signin =
203 SigninManagerFactory::GetForProfile(&profile_);
202 signin->SetAuthenticatedUsername("test_user"); 204 signin->SetAuthenticatedUsername("test_user");
203 token_service_ = static_cast<TokenService*>( 205 token_service_ = static_cast<TokenService*>(
204 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( 206 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse(
205 &profile_, BuildTokenService)); 207 &profile_, BuildTokenService));
206 208
207 PasswordTestProfileSyncService* sync = 209 PasswordTestProfileSyncService* sync =
208 static_cast<PasswordTestProfileSyncService*>( 210 static_cast<PasswordTestProfileSyncService*>(
209 ProfileSyncServiceFactory::GetInstance()-> 211 ProfileSyncServiceFactory::GetInstance()->
210 SetTestingFactoryAndUse(&profile_, 212 SetTestingFactoryAndUse(&profile_,
211 &PasswordTestProfileSyncService::Build)); 213 &PasswordTestProfileSyncService::Build));
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 CreateRootHelper create_root(this, syncer::PASSWORDS); 659 CreateRootHelper create_root(this, syncer::PASSWORDS);
658 StartSyncService(create_root.callback(), 660 StartSyncService(create_root.callback(),
659 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); 661 base::Bind(&AddPasswordEntriesCallback, this, sync_forms));
660 662
661 std::vector<PasswordForm> new_sync_forms; 663 std::vector<PasswordForm> new_sync_forms;
662 GetPasswordEntriesFromSyncDB(&new_sync_forms); 664 GetPasswordEntriesFromSyncDB(&new_sync_forms);
663 665
664 EXPECT_EQ(1U, new_sync_forms.size()); 666 EXPECT_EQ(1U, new_sync_forms.size());
665 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); 667 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0]));
666 } 668 }
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