| 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/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 AuthError auth_error_; | 84 AuthError auth_error_; |
| 85 std::string username_; | 85 std::string username_; |
| 86 std::string password_; | 86 std::string password_; |
| 87 std::string captcha_; | 87 std::string captcha_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // A PSS subtype to inject. | 90 // A PSS subtype to inject. |
| 91 class ProfileSyncServiceForWizardTest : public ProfileSyncService { | 91 class ProfileSyncServiceForWizardTest : public ProfileSyncService { |
| 92 public: | 92 public: |
| 93 ProfileSyncServiceForWizardTest(ProfileSyncComponentsFactory* factory, | 93 ProfileSyncServiceForWizardTest(Profile* profile, |
| 94 Profile* profile, | |
| 95 ProfileSyncService::StartBehavior behavior) | 94 ProfileSyncService::StartBehavior behavior) |
| 96 : ProfileSyncService(factory, profile, NULL, behavior), | 95 : ProfileSyncService(NULL, profile, NULL, behavior), |
| 97 user_cancelled_dialog_(false), | 96 user_cancelled_dialog_(false), |
| 98 is_using_secondary_passphrase_(false), | 97 is_using_secondary_passphrase_(false), |
| 99 encrypt_everything_(false) { | 98 encrypt_everything_(false) { |
| 100 signin_ = &mock_signin_; | 99 signin_ = &mock_signin_; |
| 101 ResetTestStats(); | 100 ResetTestStats(); |
| 102 } | 101 } |
| 103 | 102 |
| 104 virtual ~ProfileSyncServiceForWizardTest() {} | 103 virtual ~ProfileSyncServiceForWizardTest() {} |
| 105 | 104 |
| 106 virtual void OnUserChoseDatatypes( | 105 virtual void OnUserChoseDatatypes( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 179 |
| 181 private: | 180 private: |
| 182 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest); | 181 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest); |
| 183 }; | 182 }; |
| 184 | 183 |
| 185 class TestingProfileWithSyncService : public TestingProfile { | 184 class TestingProfileWithSyncService : public TestingProfile { |
| 186 public: | 185 public: |
| 187 explicit TestingProfileWithSyncService( | 186 explicit TestingProfileWithSyncService( |
| 188 ProfileSyncService::StartBehavior behavior) { | 187 ProfileSyncService::StartBehavior behavior) { |
| 189 sync_service_.reset(new ProfileSyncServiceForWizardTest( | 188 sync_service_.reset(new ProfileSyncServiceForWizardTest( |
| 190 &factory_, this, behavior)); | 189 this, behavior)); |
| 191 } | 190 } |
| 192 | 191 |
| 193 virtual ProfileSyncService* GetProfileSyncService() { | 192 virtual ProfileSyncService* GetProfileSyncService() { |
| 194 return sync_service_.get(); | 193 return sync_service_.get(); |
| 195 } | 194 } |
| 196 private: | 195 private: |
| 197 ProfileSyncComponentsFactoryMock factory_; | 196 ProfileSyncComponentsFactoryMock factory_; |
| 198 scoped_ptr<ProfileSyncService> sync_service_; | 197 scoped_ptr<ProfileSyncService> sync_service_; |
| 199 }; | 198 }; |
| 200 | 199 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 dialog_args.GetInteger("error", &error); | 640 dialog_args.GetInteger("error", &error); |
| 642 EXPECT_EQ(0, error); | 641 EXPECT_EQ(0, error); |
| 643 bool editable = true; | 642 bool editable = true; |
| 644 dialog_args.GetBoolean("editable_user", &editable); | 643 dialog_args.GetBoolean("editable_user", &editable); |
| 645 EXPECT_FALSE(editable); | 644 EXPECT_FALSE(editable); |
| 646 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 645 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
| 647 EXPECT_TRUE(service_->user_cancelled_dialog_); | 646 EXPECT_TRUE(service_->user_cancelled_dialog_); |
| 648 EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( | 647 EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( |
| 649 prefs::kSyncHasSetupCompleted)); | 648 prefs::kSyncHasSetupCompleted)); |
| 650 } | 649 } |
| OLD | NEW |