| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/sync_setup_wizard.h" | 5 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); | 306 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); |
| 307 AttachSyncSetupHandler(); | 307 AttachSyncSetupHandler(); |
| 308 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 308 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
| 309 wizard_->Step(SyncSetupWizard::CONFIGURE); | 309 wizard_->Step(SyncSetupWizard::CONFIGURE); |
| 310 | 310 |
| 311 ListValue data_type_choices_value; | 311 ListValue data_type_choices_value; |
| 312 std::string data_type_choices = | 312 std::string data_type_choices = |
| 313 "{\"syncAllDataTypes\":false,\"syncBookmarks\":true," | 313 "{\"syncAllDataTypes\":false,\"syncBookmarks\":true," |
| 314 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," | 314 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," |
| 315 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," | 315 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," |
| 316 "\"syncApps\":true,\"syncSearchEngines\":false,\"syncSessions\":false," | 316 "\"syncApps\":true,\"syncSessions\":false,\"usePassphrase\":false," |
| 317 "\"usePassphrase\":false,\"encryptAllData\":false}"; | 317 "\"encryptAllData\":false}"; |
| 318 data_type_choices_value.Append(new StringValue(data_type_choices)); | 318 data_type_choices_value.Append(new StringValue(data_type_choices)); |
| 319 | 319 |
| 320 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and | 320 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and |
| 321 // apps are on, the rest are off. | 321 // apps are on, the rest are off. |
| 322 handler_.HandleConfigure(&data_type_choices_value); | 322 handler_.HandleConfigure(&data_type_choices_value); |
| 323 // Since we don't need a passphrase, wizard should have transitioned to | 323 // Since we don't need a passphrase, wizard should have transitioned to |
| 324 // DONE state and closed the UI. | 324 // DONE state and closed the UI. |
| 325 EXPECT_FALSE(wizard_->IsVisible()); | 325 EXPECT_FALSE(wizard_->IsVisible()); |
| 326 EXPECT_FALSE(service_->keep_everything_synced_); | 326 EXPECT_FALSE(service_->keep_everything_synced_); |
| 327 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS)); | 327 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS)); |
| 328 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES)); | 328 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES)); |
| 329 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES)); | 329 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES)); |
| 330 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS)); | 330 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS)); |
| 331 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::AUTOFILL)); | 331 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::AUTOFILL)); |
| 332 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::EXTENSIONS)); | 332 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::EXTENSIONS)); |
| 333 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::TYPED_URLS)); | 333 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::TYPED_URLS)); |
| 334 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::APPS)); | 334 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::APPS)); |
| 335 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::SEARCH_ENGINES)); | |
| 336 EXPECT_EQ(0U, service_->chosen_data_types_.count( | 335 EXPECT_EQ(0U, service_->chosen_data_types_.count( |
| 337 syncable::APP_NOTIFICATIONS)); | 336 syncable::APP_NOTIFICATIONS)); |
| 338 } | 337 } |
| 339 | 338 |
| 340 TEST_F(SyncSetupWizardTest, EnterPassphraseRequired) { | 339 TEST_F(SyncSetupWizardTest, EnterPassphraseRequired) { |
| 341 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); | 340 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); |
| 342 AttachSyncSetupHandler(); | 341 AttachSyncSetupHandler(); |
| 343 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 342 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
| 344 wizard_->Step(SyncSetupWizard::CONFIGURE); | 343 wizard_->Step(SyncSetupWizard::CONFIGURE); |
| 345 wizard_->Step(SyncSetupWizard::SETTING_UP); | 344 wizard_->Step(SyncSetupWizard::SETTING_UP); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 558 |
| 560 service_->set_last_auth_error( | 559 service_->set_last_auth_error( |
| 561 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); | 560 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); |
| 562 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); | 561 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); |
| 563 AttachSyncSetupHandler(); | 562 AttachSyncSetupHandler(); |
| 564 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); | 563 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); |
| 565 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); | 564 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); |
| 566 CloseSetupUI(); | 565 CloseSetupUI(); |
| 567 EXPECT_FALSE(wizard_->IsVisible()); | 566 EXPECT_FALSE(wizard_->IsVisible()); |
| 568 } | 567 } |
| OLD | NEW |