| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 result.SetBoolean("usePassphrase", !passphrase.empty()); | 79 result.SetBoolean("usePassphrase", !passphrase.empty()); |
| 80 if (!passphrase.empty()) | 80 if (!passphrase.empty()) |
| 81 result.SetString("passphrase", passphrase); | 81 result.SetString("passphrase", passphrase); |
| 82 // Add all of our data types. | 82 // Add all of our data types. |
| 83 result.SetBoolean("appsSynced", types.Has(syncer::APPS)); | 83 result.SetBoolean("appsSynced", types.Has(syncer::APPS)); |
| 84 result.SetBoolean("autofillSynced", types.Has(syncer::AUTOFILL)); | 84 result.SetBoolean("autofillSynced", types.Has(syncer::AUTOFILL)); |
| 85 result.SetBoolean("bookmarksSynced", types.Has(syncer::BOOKMARKS)); | 85 result.SetBoolean("bookmarksSynced", types.Has(syncer::BOOKMARKS)); |
| 86 result.SetBoolean("extensionsSynced", types.Has(syncer::EXTENSIONS)); | 86 result.SetBoolean("extensionsSynced", types.Has(syncer::EXTENSIONS)); |
| 87 result.SetBoolean("passwordsSynced", types.Has(syncer::PASSWORDS)); | 87 result.SetBoolean("passwordsSynced", types.Has(syncer::PASSWORDS)); |
| 88 result.SetBoolean("preferencesSynced", types.Has(syncer::PREFERENCES)); | 88 result.SetBoolean("preferencesSynced", types.Has(syncer::PREFERENCES)); |
| 89 result.SetBoolean("sessionsSynced", types.Has(syncer::SESSIONS)); | 89 result.SetBoolean("tabsSynced", types.Has(syncer::PROXY_TABS)); |
| 90 result.SetBoolean("themesSynced", types.Has(syncer::THEMES)); | 90 result.SetBoolean("themesSynced", types.Has(syncer::THEMES)); |
| 91 result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS)); | 91 result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS)); |
| 92 std::string args; | 92 std::string args; |
| 93 base::JSONWriter::Write(&result, &args); | 93 base::JSONWriter::Write(&result, &args); |
| 94 return args; | 94 return args; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void CheckInt(const DictionaryValue* dictionary, | 97 void CheckInt(const DictionaryValue* dictionary, |
| 98 const std::string& key, | 98 const std::string& key, |
| 99 int expected_value) { | 99 int expected_value) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void CheckConfigDataTypeArguments(DictionaryValue* dictionary, | 178 void CheckConfigDataTypeArguments(DictionaryValue* dictionary, |
| 179 SyncAllDataConfig config, | 179 SyncAllDataConfig config, |
| 180 syncer::ModelTypeSet types) { | 180 syncer::ModelTypeSet types) { |
| 181 CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA); | 181 CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA); |
| 182 CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS)); | 182 CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS)); |
| 183 CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL)); | 183 CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL)); |
| 184 CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS)); | 184 CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS)); |
| 185 CheckBool(dictionary, "extensionsSynced", types.Has(syncer::EXTENSIONS)); | 185 CheckBool(dictionary, "extensionsSynced", types.Has(syncer::EXTENSIONS)); |
| 186 CheckBool(dictionary, "passwordsSynced", types.Has(syncer::PASSWORDS)); | 186 CheckBool(dictionary, "passwordsSynced", types.Has(syncer::PASSWORDS)); |
| 187 CheckBool(dictionary, "preferencesSynced", types.Has(syncer::PREFERENCES)); | 187 CheckBool(dictionary, "preferencesSynced", types.Has(syncer::PREFERENCES)); |
| 188 CheckBool(dictionary, "sessionsSynced", types.Has(syncer::SESSIONS)); | 188 CheckBool(dictionary, "tabsSynced", types.Has(syncer::PROXY_TABS)); |
| 189 CheckBool(dictionary, "themesSynced", types.Has(syncer::THEMES)); | 189 CheckBool(dictionary, "themesSynced", types.Has(syncer::THEMES)); |
| 190 CheckBool(dictionary, "typedUrlsSynced", types.Has(syncer::TYPED_URLS)); | 190 CheckBool(dictionary, "typedUrlsSynced", types.Has(syncer::TYPED_URLS)); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 } // namespace | 194 } // namespace |
| 195 | 195 |
| 196 // Test instance of WebUI that tracks the data passed to | 196 // Test instance of WebUI that tracks the data passed to |
| 197 // CallJavascriptFunction(). | 197 // CallJavascriptFunction(). |
| 198 class TestWebUI : public content::WebUI { | 198 class TestWebUI : public content::WebUI { |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 DictionaryValue* dictionary; | 1099 DictionaryValue* dictionary; |
| 1100 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); | 1100 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); |
| 1101 CheckBool(dictionary, "showSyncEverythingPage", false); | 1101 CheckBool(dictionary, "showSyncEverythingPage", false); |
| 1102 CheckBool(dictionary, "syncAllDataTypes", true); | 1102 CheckBool(dictionary, "syncAllDataTypes", true); |
| 1103 CheckBool(dictionary, "appsRegistered", true); | 1103 CheckBool(dictionary, "appsRegistered", true); |
| 1104 CheckBool(dictionary, "autofillRegistered", true); | 1104 CheckBool(dictionary, "autofillRegistered", true); |
| 1105 CheckBool(dictionary, "bookmarksRegistered", true); | 1105 CheckBool(dictionary, "bookmarksRegistered", true); |
| 1106 CheckBool(dictionary, "extensionsRegistered", true); | 1106 CheckBool(dictionary, "extensionsRegistered", true); |
| 1107 CheckBool(dictionary, "passwordsRegistered", true); | 1107 CheckBool(dictionary, "passwordsRegistered", true); |
| 1108 CheckBool(dictionary, "preferencesRegistered", true); | 1108 CheckBool(dictionary, "preferencesRegistered", true); |
| 1109 CheckBool(dictionary, "sessionsRegistered", true); | 1109 CheckBool(dictionary, "tabsRegistered", true); |
| 1110 CheckBool(dictionary, "themesRegistered", true); | 1110 CheckBool(dictionary, "themesRegistered", true); |
| 1111 CheckBool(dictionary, "typedUrlsRegistered", true); | 1111 CheckBool(dictionary, "typedUrlsRegistered", true); |
| 1112 CheckBool(dictionary, "showPassphrase", false); | 1112 CheckBool(dictionary, "showPassphrase", false); |
| 1113 CheckBool(dictionary, "usePassphrase", false); | 1113 CheckBool(dictionary, "usePassphrase", false); |
| 1114 CheckBool(dictionary, "passphraseFailed", false); | 1114 CheckBool(dictionary, "passphraseFailed", false); |
| 1115 CheckBool(dictionary, "encryptAllData", false); | 1115 CheckBool(dictionary, "encryptAllData", false); |
| 1116 CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); | 1116 CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 TEST_P(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { | 1119 TEST_P(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1269 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
| 1270 handler_->CloseSyncSetup(); | 1270 handler_->CloseSyncSetup(); |
| 1271 EXPECT_EQ(NULL, | 1271 EXPECT_EQ(NULL, |
| 1272 LoginUIServiceFactory::GetForProfile( | 1272 LoginUIServiceFactory::GetForProfile( |
| 1273 profile_.get())->current_login_ui()); | 1273 profile_.get())->current_login_ui()); |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, | 1276 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, |
| 1277 SyncSetupHandlerTest, | 1277 SyncSetupHandlerTest, |
| 1278 Values(true, false)); | 1278 Values(true, false)); |
| OLD | NEW |