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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); | 317 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); |
318 AttachSyncSetupHandler(); | 318 AttachSyncSetupHandler(); |
319 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 319 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
320 wizard_->Step(SyncSetupWizard::CONFIGURE); | 320 wizard_->Step(SyncSetupWizard::CONFIGURE); |
321 | 321 |
322 ListValue data_type_choices_value; | 322 ListValue data_type_choices_value; |
323 std::string data_type_choices = | 323 std::string data_type_choices = |
324 "{\"keepEverythingSynced\":false,\"syncBookmarks\":true," | 324 "{\"keepEverythingSynced\":false,\"syncBookmarks\":true," |
325 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," | 325 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," |
326 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," | 326 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," |
327 "\"syncApps\":true,\"syncSessions\":false,\"usePassphrase\":false," | 327 "\"syncApps\":true,\"syncSearchEngines\":false,\"syncSessions\":false," |
328 "\"encryptAllData\":false}"; | 328 "\"usePassphrase\":false,\"encryptAllData\":false}"; |
329 data_type_choices_value.Append(new StringValue(data_type_choices)); | 329 data_type_choices_value.Append(new StringValue(data_type_choices)); |
330 | 330 |
331 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and | 331 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and |
332 // apps are on, the rest are off. | 332 // apps are on, the rest are off. |
333 handler_.HandleConfigure(&data_type_choices_value); | 333 handler_.HandleConfigure(&data_type_choices_value); |
334 EXPECT_TRUE(wizard_->IsVisible()); | 334 EXPECT_TRUE(wizard_->IsVisible()); |
335 EXPECT_FALSE(service_->keep_everything_synced_); | 335 EXPECT_FALSE(service_->keep_everything_synced_); |
336 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS)); | 336 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS)); |
337 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES)); | 337 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES)); |
338 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES)); | 338 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES)); |
339 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS)); | 339 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS)); |
340 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::AUTOFILL)); | 340 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::AUTOFILL)); |
341 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::EXTENSIONS)); | 341 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::EXTENSIONS)); |
342 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::TYPED_URLS)); | 342 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::TYPED_URLS)); |
343 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::APPS)); | 343 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::APPS)); |
| 344 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::SEARCH_ENGINES)); |
344 | 345 |
345 CloseSetupUI(); | 346 CloseSetupUI(); |
346 } | 347 } |
347 | 348 |
348 TEST_F(SyncSetupWizardTest, EnterPassphraseRequired) { | 349 TEST_F(SyncSetupWizardTest, EnterPassphraseRequired) { |
349 SKIP_TEST_ON_MACOSX(); | 350 SKIP_TEST_ON_MACOSX(); |
350 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); | 351 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); |
351 AttachSyncSetupHandler(); | 352 AttachSyncSetupHandler(); |
352 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 353 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
353 wizard_->Step(SyncSetupWizard::CONFIGURE); | 354 wizard_->Step(SyncSetupWizard::CONFIGURE); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); | 581 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); |
581 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); | 582 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); |
582 AttachSyncSetupHandler(); | 583 AttachSyncSetupHandler(); |
583 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); | 584 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); |
584 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); | 585 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); |
585 CloseSetupUI(); | 586 CloseSetupUI(); |
586 EXPECT_FALSE(wizard_->IsVisible()); | 587 EXPECT_FALSE(wizard_->IsVisible()); |
587 } | 588 } |
588 | 589 |
589 #undef SKIP_TEST_ON_MACOSX | 590 #undef SKIP_TEST_ON_MACOSX |
OLD | NEW |