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

Unified Diff: chrome/browser/sync/credential_cache_service_factory_win.cc

Issue 10867019: [sync] Add hooks to allow for testing sync credential caching in the presence of strange singleton … (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/credential_cache_service_factory_win.cc
diff --git a/chrome/browser/sync/credential_cache_service_factory_win.cc b/chrome/browser/sync/credential_cache_service_factory_win.cc
index a66c72b4ad169498d3da5ab47160f9e38589b70d..35f8697ae1c9f227d80653531481e3ebd2aca48c 100644
--- a/chrome/browser/sync/credential_cache_service_factory_win.cc
+++ b/chrome/browser/sync/credential_cache_service_factory_win.cc
@@ -54,6 +54,19 @@ bool CredentialCacheServiceFactory::IsDefaultProfile(Profile* profile) {
ProfileManager::GetDefaultProfileDir(default_user_data_dir);
}
+// static
+// TODO(rsimha): This is a test-only hook. Remove before shipping.
+// See http://crbug.com/144280.
+bool CredentialCacheServiceFactory::IsDefaultAlternateProfileForTest(
+ Profile* profile) {
+ DCHECK(profile);
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ FilePath alternate_user_data_dir;
+ chrome::GetAlternateUserDataDirectory(&alternate_user_data_dir);
+ return profile->GetPath() ==
+ ProfileManager::GetDefaultProfileDir(alternate_user_data_dir);
+}
+
bool CredentialCacheServiceFactory::ServiceIsCreatedWithProfile() {
return true;
}
@@ -62,9 +75,14 @@ ProfileKeyedService* CredentialCacheServiceFactory::BuildServiceInstanceFor(
Profile* profile) const {
// Only instantiate a CredentialCacheService object if we are running in the
// default profile on Windows 8, and if credential caching is enabled.
+ // TODO(rsimha): To allow for testing, start CredentialCacheService if we are
+ // either in the default profile or the default alternate profile, so that
+ // an instance of desktop chrome using the default metro directory can be
+ // used for testing. See http://crbug.com/144280.
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
- IsDefaultProfile(profile) &&
+ (IsDefaultProfile(profile) ||
+ IsDefaultAlternateProfileForTest(profile)) &&
command_line->HasSwitch(switches::kEnableSyncCredentialCaching)) {
return new syncer::CredentialCacheService(profile);
}
« no previous file with comments | « chrome/browser/sync/credential_cache_service_factory_win.h ('k') | chrome/browser/sync/credential_cache_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698