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

Unified Diff: chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc

Issue 1578173005: Move Autofill Payments integration checkbox to the sync settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace bool with enum in tests Created 4 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/options/sync_setup_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc
index 7aeb5f11e8564115394f08181d150b1b7e885188..7fcc635894a07323a8ded6d3769cc75b53bdad9e 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc
+++ b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc
@@ -67,6 +67,11 @@ enum EncryptAllConfig {
ENCRYPT_PASSWORDS
};
+enum PaymentsIntegrationConfig {
+ PAYMENTS_INTEGRATION_ENABLED,
+ PAYMENTS_INTEGRATION_DISABLED
+};
+
// Create a json-format string with the key/value pairs appropriate for a call
// to HandleConfigure(). If |extra_values| is non-null, then the values from
// the passed dictionary are added to the json.
@@ -74,7 +79,8 @@ std::string GetConfiguration(const base::DictionaryValue* extra_values,
SyncAllDataConfig sync_all,
syncer::ModelTypeSet types,
const std::string& passphrase,
- EncryptAllConfig encrypt_all) {
+ EncryptAllConfig encrypt_all,
+ PaymentsIntegrationConfig payments_integration) {
base::DictionaryValue result;
if (extra_values)
result.MergeDictionary(extra_values);
@@ -96,6 +102,8 @@ std::string GetConfiguration(const base::DictionaryValue* extra_values,
result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS));
result.SetBoolean("wifiCredentialsSynced",
types.Has(syncer::WIFI_CREDENTIALS));
+ result.SetBoolean("paymentsIntegrationEnabled",
+ payments_integration == PAYMENTS_INTEGRATION_ENABLED);
std::string args;
base::JSONWriter::Write(result, &args);
return args;
@@ -518,8 +526,9 @@ TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) {
#endif // #if !defined(OS_CHROMEOS)
TEST_F(SyncSetupHandlerTest, TestSyncEverything) {
- std::string args = GetConfiguration(
- NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(),
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -536,8 +545,9 @@ TEST_F(SyncSetupHandlerTest, TestSyncEverything) {
}
TEST_F(SyncSetupHandlerTest, TestSyncNothing) {
- std::string args = GetConfiguration(
- NULL, SYNC_NOTHING, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(NULL, SYNC_NOTHING, GetAllTypes(), std::string(),
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, RequestStop(ProfileSyncService::CLEAR_DATA));
@@ -551,8 +561,9 @@ TEST_F(SyncSetupHandlerTest, TestSyncNothing) {
}
TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) {
- std::string args = GetConfiguration(
- NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA);
+ std::string args =
+ GetConfiguration(NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(),
+ ENCRYPT_ALL_DATA, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -572,8 +583,9 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) {
}
TEST_F(SyncSetupHandlerTest, TestPassphraseStillRequired) {
- std::string args = GetConfiguration(
- NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(),
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -595,11 +607,9 @@ TEST_F(SyncSetupHandlerTest, TestPassphraseStillRequired) {
TEST_F(SyncSetupHandlerTest, SuccessfullySetPassphrase) {
base::DictionaryValue dict;
dict.SetBoolean("isGooglePassphrase", true);
- std::string args = GetConfiguration(&dict,
- SYNC_ALL_DATA,
- GetAllTypes(),
- "gaiaPassphrase",
- ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(&dict, SYNC_ALL_DATA, GetAllTypes(), "gaiaPassphrase",
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
// Act as if an encryption passphrase is required the first time, then never
@@ -622,11 +632,9 @@ TEST_F(SyncSetupHandlerTest, SuccessfullySetPassphrase) {
TEST_F(SyncSetupHandlerTest, SelectCustomEncryption) {
base::DictionaryValue dict;
dict.SetBoolean("isGooglePassphrase", false);
- std::string args = GetConfiguration(&dict,
- SYNC_ALL_DATA,
- GetAllTypes(),
- "custom_passphrase",
- ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(&dict, SYNC_ALL_DATA, GetAllTypes(), "custom_passphrase",
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -649,11 +657,9 @@ TEST_F(SyncSetupHandlerTest, SelectCustomEncryption) {
TEST_F(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) {
base::DictionaryValue dict;
dict.SetBoolean("isGooglePassphrase", true);
- std::string args = GetConfiguration(&dict,
- SYNC_ALL_DATA,
- GetAllTypes(),
- "invalid_passphrase",
- ENCRYPT_PASSWORDS);
+ std::string args = GetConfiguration(&dict, SYNC_ALL_DATA, GetAllTypes(),
+ "invalid_passphrase", ENCRYPT_PASSWORDS,
+ PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -689,11 +695,9 @@ TEST_F(SyncSetupHandlerTest, TestSyncIndividualTypes) {
for (it = user_selectable_types.First(); it.Good(); it.Inc()) {
syncer::ModelTypeSet type_to_set;
type_to_set.Put(it.Get());
- std::string args = GetConfiguration(NULL,
- CHOOSE_WHAT_TO_SYNC,
- type_to_set,
- std::string(),
- ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(NULL, CHOOSE_WHAT_TO_SYNC, type_to_set, std::string(),
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -712,11 +716,9 @@ TEST_F(SyncSetupHandlerTest, TestSyncIndividualTypes) {
}
TEST_F(SyncSetupHandlerTest, TestSyncAllManually) {
- std::string args = GetConfiguration(NULL,
- CHOOSE_WHAT_TO_SYNC,
- GetAllTypes(),
- std::string(),
- ENCRYPT_PASSWORDS);
+ std::string args =
+ GetConfiguration(NULL, CHOOSE_WHAT_TO_SYNC, GetAllTypes(), std::string(),
+ ENCRYPT_PASSWORDS, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
@@ -810,6 +812,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupSyncEverything) {
CheckBool(dictionary, "tabsRegistered", true);
CheckBool(dictionary, "themesRegistered", true);
CheckBool(dictionary, "typedUrlsRegistered", true);
+ CheckBool(dictionary, "paymentsIntegrationEnabled", true);
CheckBool(dictionary, "showPassphrase", false);
CheckBool(dictionary, "usePassphrase", false);
CheckBool(dictionary, "passphraseFailed", false);
@@ -954,8 +957,9 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) {
}
TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) {
- std::string args = GetConfiguration(
- NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA);
+ std::string args =
+ GetConfiguration(NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(),
+ ENCRYPT_ALL_DATA, PAYMENTS_INTEGRATION_ENABLED);
base::ListValue list_args;
list_args.Append(new base::StringValue(args));
EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
« no previous file with comments | « chrome/browser/ui/webui/options/sync_setup_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698