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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_view_utils_desktop_unittest.cc

Issue 2354613002: [Sync] Fix namespaces for the browser_sync component. (Closed)
Patch Set: Address comments. Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/ui/passwords/manage_passwords_view_utils_desktop.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils_desktop.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/mock_entropy_provider.h" 9 #include "base/test/mock_entropy_provider.h"
10 #include "chrome/browser/sync/profile_sync_service_factory.h" 10 #include "chrome/browser/sync/profile_sync_service_factory.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const char* name) { 63 const char* name) {
64 settings_behaviour_change_ = base::FieldTrialList::CreateFieldTrial( 64 settings_behaviour_change_ = base::FieldTrialList::CreateFieldTrial(
65 kPasswordManagerSettingsBehaviourChangeFieldTrialName, name); 65 kPasswordManagerSettingsBehaviourChangeFieldTrialName, name);
66 } 66 }
67 67
68 void EnforceSmartLockBrandingExperiment(const char* name) { 68 void EnforceSmartLockBrandingExperiment(const char* name) {
69 smart_lock_branding_ = 69 smart_lock_branding_ =
70 base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName, name); 70 base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName, name);
71 } 71 }
72 72
73 ProfileSyncService* GetSyncServiceForSmartLockUser() { 73 browser_sync::ProfileSyncService* GetSyncServiceForSmartLockUser() {
74 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( 74 browser_sync::ProfileSyncServiceMock* sync_service =
75 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_)); 75 static_cast<browser_sync::ProfileSyncServiceMock*>(
76 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_));
76 EXPECT_CALL(*sync_service, IsSyncActive()).WillRepeatedly(Return(true)); 77 EXPECT_CALL(*sync_service, IsSyncActive()).WillRepeatedly(Return(true));
77 EXPECT_CALL(*sync_service, IsFirstSetupComplete()) 78 EXPECT_CALL(*sync_service, IsFirstSetupComplete())
78 .WillRepeatedly(Return(true)); 79 .WillRepeatedly(Return(true));
79 EXPECT_CALL(*sync_service, GetActiveDataTypes()) 80 EXPECT_CALL(*sync_service, GetActiveDataTypes())
80 .WillRepeatedly(Return(syncer::UserSelectableTypes())); 81 .WillRepeatedly(Return(syncer::UserSelectableTypes()));
81 EXPECT_CALL(*sync_service, IsUsingSecondaryPassphrase()) 82 EXPECT_CALL(*sync_service, IsUsingSecondaryPassphrase())
82 .WillRepeatedly(Return(false)); 83 .WillRepeatedly(Return(false));
83 return sync_service; 84 return sync_service;
84 } 85 }
85 86
86 ProfileSyncService* GetSyncServiceForNonSmartLockUser() { 87 browser_sync::ProfileSyncService* GetSyncServiceForNonSmartLockUser() {
87 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( 88 browser_sync::ProfileSyncServiceMock* sync_service =
88 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_)); 89 static_cast<browser_sync::ProfileSyncServiceMock*>(
90 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_));
89 EXPECT_CALL(*sync_service, IsSyncActive()).WillRepeatedly(Return(false)); 91 EXPECT_CALL(*sync_service, IsSyncActive()).WillRepeatedly(Return(false));
90 return sync_service; 92 return sync_service;
91 } 93 }
92 94
93 private: 95 private:
94 content::TestBrowserThreadBundle thread_bundle_; 96 content::TestBrowserThreadBundle thread_bundle_;
95 TestingProfile profile_; 97 TestingProfile profile_;
96 scoped_refptr<base::FieldTrial> smart_lock_branding_; 98 scoped_refptr<base::FieldTrial> smart_lock_branding_;
97 scoped_refptr<base::FieldTrial> settings_migration_; 99 scoped_refptr<base::FieldTrial> settings_migration_;
98 scoped_refptr<base::FieldTrial> settings_behaviour_change_; 100 scoped_refptr<base::FieldTrial> settings_behaviour_change_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 {"Non Smart Lock User, behavioral change, migration", 147 {"Non Smart Lock User, behavioral change, migration",
146 kSmartLockNoBrandingGroupName, 148 kSmartLockNoBrandingGroupName,
147 kEnabledPasswordManagerSettingsMigrationGroupName, 149 kEnabledPasswordManagerSettingsMigrationGroupName,
148 kPasswordManagerSettingsBehaviourChangeEnabledGroupName, 150 kPasswordManagerSettingsBehaviourChangeEnabledGroupName,
149 NON_SMART_LOCK_USER, IDS_OPTIONS_PASSWORD_MANAGER_ENABLE}, 151 NON_SMART_LOCK_USER, IDS_OPTIONS_PASSWORD_MANAGER_ENABLE},
150 }; 152 };
151 153
152 for (const auto& test_case : kTestData) { 154 for (const auto& test_case : kTestData) {
153 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); 155 base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
154 SCOPED_TRACE(testing::Message(test_case.description)); 156 SCOPED_TRACE(testing::Message(test_case.description));
155 ProfileSyncService* sync_service; 157 browser_sync::ProfileSyncService* sync_service;
156 if (test_case.user_type == SMART_LOCK_USER) 158 if (test_case.user_type == SMART_LOCK_USER)
157 sync_service = GetSyncServiceForSmartLockUser(); 159 sync_service = GetSyncServiceForSmartLockUser();
158 else 160 else
159 sync_service = GetSyncServiceForNonSmartLockUser(); 161 sync_service = GetSyncServiceForNonSmartLockUser();
160 EnforceSmartLockBrandingExperiment( 162 EnforceSmartLockBrandingExperiment(
161 test_case.smart_lock_branding_experiment_group); 163 test_case.smart_lock_branding_experiment_group);
162 EnforcePasswordManagerSettingMigrationExperiment( 164 EnforcePasswordManagerSettingMigrationExperiment(
163 test_case.settings_migration_experiment_group); 165 test_case.settings_migration_experiment_group);
164 EnforcePasswordManagerSettingsBehaviourChangeExperiment( 166 EnforcePasswordManagerSettingsBehaviourChangeExperiment(
165 test_case.settings_behaviour_change_experiment_group); 167 test_case.settings_behaviour_change_experiment_group);
166 EXPECT_EQ( 168 EXPECT_EQ(
167 l10n_util::GetStringUTF16(test_case.expected_setting_description_id), 169 l10n_util::GetStringUTF16(test_case.expected_setting_description_id),
168 l10n_util::GetStringUTF16( 170 l10n_util::GetStringUTF16(
169 GetPasswordManagerSettingsStringId(sync_service))); 171 GetPasswordManagerSettingsStringId(sync_service)));
170 } 172 }
171 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698