| OLD | NEW |
| 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 "chrome/browser/ui/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 result.MergeDictionary(extra_values); | 91 result.MergeDictionary(extra_values); |
| 92 result.SetBoolean("syncAllDataTypes", sync_all == SYNC_ALL_DATA); | 92 result.SetBoolean("syncAllDataTypes", sync_all == SYNC_ALL_DATA); |
| 93 result.SetBoolean("encryptAllData", encrypt_all == ENCRYPT_ALL_DATA); | 93 result.SetBoolean("encryptAllData", encrypt_all == ENCRYPT_ALL_DATA); |
| 94 result.SetBoolean("usePassphrase", !passphrase.empty()); | 94 result.SetBoolean("usePassphrase", !passphrase.empty()); |
| 95 if (!passphrase.empty()) | 95 if (!passphrase.empty()) |
| 96 result.SetString("passphrase", passphrase); | 96 result.SetString("passphrase", passphrase); |
| 97 // Add all of our data types. | 97 // Add all of our data types. |
| 98 result.SetBoolean("appsSynced", types.Has(syncer::APPS)); | 98 result.SetBoolean("appsSynced", types.Has(syncer::APPS)); |
| 99 result.SetBoolean("autofillSynced", types.Has(syncer::AUTOFILL)); | 99 result.SetBoolean("autofillSynced", types.Has(syncer::AUTOFILL)); |
| 100 result.SetBoolean("bookmarksSynced", types.Has(syncer::BOOKMARKS)); | 100 result.SetBoolean("bookmarksSynced", types.Has(syncer::BOOKMARKS)); |
| 101 result.SetBoolean("dictionarySynced", types.Has(syncer::DICTIONARY)); |
| 101 result.SetBoolean("extensionsSynced", types.Has(syncer::EXTENSIONS)); | 102 result.SetBoolean("extensionsSynced", types.Has(syncer::EXTENSIONS)); |
| 102 result.SetBoolean("passwordsSynced", types.Has(syncer::PASSWORDS)); | 103 result.SetBoolean("passwordsSynced", types.Has(syncer::PASSWORDS)); |
| 103 result.SetBoolean("preferencesSynced", types.Has(syncer::PREFERENCES)); | 104 result.SetBoolean("preferencesSynced", types.Has(syncer::PREFERENCES)); |
| 104 result.SetBoolean("sessionsSynced", types.Has(syncer::SESSIONS)); | 105 result.SetBoolean("sessionsSynced", types.Has(syncer::SESSIONS)); |
| 105 result.SetBoolean("themesSynced", types.Has(syncer::THEMES)); | 106 result.SetBoolean("themesSynced", types.Has(syncer::THEMES)); |
| 106 result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS)); | 107 result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS)); |
| 107 std::string args; | 108 std::string args; |
| 108 base::JSONWriter::Write(&result, &args); | 109 base::JSONWriter::Write(&result, &args); |
| 109 return args; | 110 return args; |
| 110 } | 111 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Checks to make sure that the values stored in |dictionary| match the values | 191 // Checks to make sure that the values stored in |dictionary| match the values |
| 191 // expected by the showSyncSetupPage() JS function for a given set of data | 192 // expected by the showSyncSetupPage() JS function for a given set of data |
| 192 // types. | 193 // types. |
| 193 void CheckConfigDataTypeArguments(DictionaryValue* dictionary, | 194 void CheckConfigDataTypeArguments(DictionaryValue* dictionary, |
| 194 SyncAllDataConfig config, | 195 SyncAllDataConfig config, |
| 195 syncer::ModelTypeSet types) { | 196 syncer::ModelTypeSet types) { |
| 196 CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA); | 197 CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA); |
| 197 CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS)); | 198 CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS)); |
| 198 CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL)); | 199 CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL)); |
| 199 CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS)); | 200 CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS)); |
| 201 CheckBool(dictionary, "dictionarySynced", types.Has(syncer::DICTIONARY)); |
| 200 CheckBool(dictionary, "extensionsSynced", types.Has(syncer::EXTENSIONS)); | 202 CheckBool(dictionary, "extensionsSynced", types.Has(syncer::EXTENSIONS)); |
| 201 CheckBool(dictionary, "passwordsSynced", types.Has(syncer::PASSWORDS)); | 203 CheckBool(dictionary, "passwordsSynced", types.Has(syncer::PASSWORDS)); |
| 202 CheckBool(dictionary, "preferencesSynced", types.Has(syncer::PREFERENCES)); | 204 CheckBool(dictionary, "preferencesSynced", types.Has(syncer::PREFERENCES)); |
| 203 CheckBool(dictionary, "sessionsSynced", types.Has(syncer::SESSIONS)); | 205 CheckBool(dictionary, "sessionsSynced", types.Has(syncer::SESSIONS)); |
| 204 CheckBool(dictionary, "themesSynced", types.Has(syncer::THEMES)); | 206 CheckBool(dictionary, "themesSynced", types.Has(syncer::THEMES)); |
| 205 CheckBool(dictionary, "typedUrlsSynced", types.Has(syncer::TYPED_URLS)); | 207 CheckBool(dictionary, "typedUrlsSynced", types.Has(syncer::TYPED_URLS)); |
| 206 } | 208 } |
| 207 | 209 |
| 208 | 210 |
| 209 } // namespace | 211 } // namespace |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 | 1090 |
| 1089 ExpectConfig(); | 1091 ExpectConfig(); |
| 1090 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 1092 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
| 1091 DictionaryValue* dictionary; | 1093 DictionaryValue* dictionary; |
| 1092 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); | 1094 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); |
| 1093 CheckBool(dictionary, "showSyncEverythingPage", false); | 1095 CheckBool(dictionary, "showSyncEverythingPage", false); |
| 1094 CheckBool(dictionary, "syncAllDataTypes", true); | 1096 CheckBool(dictionary, "syncAllDataTypes", true); |
| 1095 CheckBool(dictionary, "appsRegistered", true); | 1097 CheckBool(dictionary, "appsRegistered", true); |
| 1096 CheckBool(dictionary, "autofillRegistered", true); | 1098 CheckBool(dictionary, "autofillRegistered", true); |
| 1097 CheckBool(dictionary, "bookmarksRegistered", true); | 1099 CheckBool(dictionary, "bookmarksRegistered", true); |
| 1100 CheckBool(dictionary, "dictionaryRegistered", false); |
| 1098 CheckBool(dictionary, "extensionsRegistered", true); | 1101 CheckBool(dictionary, "extensionsRegistered", true); |
| 1099 CheckBool(dictionary, "passwordsRegistered", true); | 1102 CheckBool(dictionary, "passwordsRegistered", true); |
| 1100 CheckBool(dictionary, "preferencesRegistered", true); | 1103 CheckBool(dictionary, "preferencesRegistered", true); |
| 1101 CheckBool(dictionary, "sessionsRegistered", true); | 1104 CheckBool(dictionary, "sessionsRegistered", true); |
| 1102 CheckBool(dictionary, "themesRegistered", true); | 1105 CheckBool(dictionary, "themesRegistered", true); |
| 1103 CheckBool(dictionary, "typedUrlsRegistered", true); | 1106 CheckBool(dictionary, "typedUrlsRegistered", true); |
| 1104 CheckBool(dictionary, "showPassphrase", false); | 1107 CheckBool(dictionary, "showPassphrase", false); |
| 1105 CheckBool(dictionary, "usePassphrase", false); | 1108 CheckBool(dictionary, "usePassphrase", false); |
| 1106 CheckBool(dictionary, "passphraseFailed", false); | 1109 CheckBool(dictionary, "passphraseFailed", false); |
| 1107 CheckBool(dictionary, "encryptAllData", false); | 1110 CheckBool(dictionary, "encryptAllData", false); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1262 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
| 1260 handler_->CloseSyncSetup(); | 1263 handler_->CloseSyncSetup(); |
| 1261 EXPECT_EQ(NULL, | 1264 EXPECT_EQ(NULL, |
| 1262 LoginUIServiceFactory::GetForProfile( | 1265 LoginUIServiceFactory::GetForProfile( |
| 1263 profile_.get())->current_login_ui()); | 1266 profile_.get())->current_login_ui()); |
| 1264 } | 1267 } |
| 1265 | 1268 |
| 1266 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, | 1269 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, |
| 1267 SyncSetupHandlerTest, | 1270 SyncSetupHandlerTest, |
| 1268 Values(true, false)); | 1271 Values(true, false)); |
| OLD | NEW |