Index: chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
index c6c9c195686aa8ffa141d00edaf8ed68f64fd71f..1d305f36b8818bda77ad34627f37560c12eaaf01 100644 |
--- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
+++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
@@ -58,7 +58,8 @@ syncer::ModelTypeSet GetAllTypes() { |
enum SyncAllDataConfig { |
SYNC_ALL_DATA, |
- CHOOSE_WHAT_TO_SYNC |
+ CHOOSE_WHAT_TO_SYNC, |
+ SYNC_NOTHING |
}; |
enum EncryptAllConfig { |
@@ -78,6 +79,7 @@ std::string GetConfiguration(const DictionaryValue* extra_values, |
if (extra_values) |
result.MergeDictionary(extra_values); |
result.SetBoolean("syncAllDataTypes", sync_all == SYNC_ALL_DATA); |
+ result.SetBoolean("syncNothing", sync_all == SYNC_NOTHING); |
result.SetBoolean("encryptAllData", encrypt_all == ENCRYPT_ALL_DATA); |
result.SetBoolean("usePassphrase", !passphrase.empty()); |
if (!passphrase.empty()) |
@@ -182,6 +184,7 @@ void CheckConfigDataTypeArguments(DictionaryValue* dictionary, |
SyncAllDataConfig config, |
syncer::ModelTypeSet types) { |
CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA); |
+ CheckBool(dictionary, "syncNothing", config == SYNC_NOTHING); |
CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS)); |
CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL)); |
CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS)); |
@@ -648,8 +651,8 @@ TEST_P(SyncSetupHandlerTest, |
GoogleServiceAuthError error( |
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
handler_->SigninFailed(error); |
- // On failure, the dialog will be closed. |
- EXPECT_EQ(NULL, |
+ // On failure, a re-auth dialog will be displayed. |
+ EXPECT_EQ(handler_.get(), |
LoginUIServiceFactory::GetForProfile( |
profile_.get())->current_login_ui()); |
} |
@@ -924,6 +927,20 @@ TEST_P(SyncSetupHandlerTest, TestSyncEverything) { |
ExpectDone(); |
} |
+TEST_P(SyncSetupHandlerTest, TestSyncNothing) { |
+ std::string args = GetConfiguration( |
+ NULL, SYNC_NOTHING, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); |
+ ListValue list_args; |
+ list_args.Append(new StringValue(args)); |
+ EXPECT_CALL(*mock_pss_, DisableForUser()); |
+ SetupInitializedProfileSyncService(); |
+ handler_->HandleConfigure(&list_args); |
+ |
+ // Ensure that the sync setup dialog was closed. |
+ const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
+ EXPECT_EQ("OptionsPage.closeOverlay", data.function_name); |
+} |
+ |
TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { |
std::string args = GetConfiguration( |
NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); |