| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 ShowSetupDone(string16()); | 53 ShowSetupDone(string16()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(MockSyncSetupHandler); | 57 DISALLOW_COPY_AND_ASSIGN(MockSyncSetupHandler); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // A PSS subtype to inject. | 60 // A PSS subtype to inject. |
| 61 class ProfileSyncServiceForWizardTest : public ProfileSyncService { | 61 class ProfileSyncServiceForWizardTest : public ProfileSyncService { |
| 62 public: | 62 public: |
| 63 ProfileSyncServiceForWizardTest(ProfileSyncComponentsFactory* factory, | 63 ProfileSyncServiceForWizardTest(Profile* profile, |
| 64 Profile* profile, | |
| 65 ProfileSyncService::StartBehavior behavior) | 64 ProfileSyncService::StartBehavior behavior) |
| 66 : ProfileSyncService(factory, profile, new SigninManager(), behavior), | 65 : ProfileSyncService(NULL, profile, new SigninManager(), behavior), |
| 67 user_cancelled_dialog_(false), | 66 user_cancelled_dialog_(false), |
| 68 is_using_secondary_passphrase_(false), | 67 is_using_secondary_passphrase_(false), |
| 69 encrypt_everything_(false) { | 68 encrypt_everything_(false) { |
| 70 ResetTestStats(); | 69 ResetTestStats(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 virtual ~ProfileSyncServiceForWizardTest() {} | 72 virtual ~ProfileSyncServiceForWizardTest() {} |
| 74 | 73 |
| 75 virtual void OnUserSubmittedAuth(const std::string& username, | 74 virtual void OnUserSubmittedAuth(const std::string& username, |
| 76 const std::string& password, | 75 const std::string& password, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 169 |
| 171 private: | 170 private: |
| 172 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest); | 171 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest); |
| 173 }; | 172 }; |
| 174 | 173 |
| 175 class TestingProfileWithSyncService : public TestingProfile { | 174 class TestingProfileWithSyncService : public TestingProfile { |
| 176 public: | 175 public: |
| 177 explicit TestingProfileWithSyncService( | 176 explicit TestingProfileWithSyncService( |
| 178 ProfileSyncService::StartBehavior behavior) { | 177 ProfileSyncService::StartBehavior behavior) { |
| 179 sync_service_.reset(new ProfileSyncServiceForWizardTest( | 178 sync_service_.reset(new ProfileSyncServiceForWizardTest( |
| 180 &factory_, this, behavior)); | 179 this, behavior)); |
| 181 } | 180 } |
| 182 | 181 |
| 183 virtual ProfileSyncService* GetProfileSyncService() { | 182 virtual ProfileSyncService* GetProfileSyncService() { |
| 184 return sync_service_.get(); | 183 return sync_service_.get(); |
| 185 } | 184 } |
| 186 private: | 185 private: |
| 187 ProfileSyncComponentsFactoryMock factory_; | 186 ProfileSyncComponentsFactoryMock factory_; |
| 188 scoped_ptr<ProfileSyncService> sync_service_; | 187 scoped_ptr<ProfileSyncService> sync_service_; |
| 189 }; | 188 }; |
| 190 | 189 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 dialog_args.GetInteger("error", &error); | 624 dialog_args.GetInteger("error", &error); |
| 626 EXPECT_EQ(0, error); | 625 EXPECT_EQ(0, error); |
| 627 bool editable = true; | 626 bool editable = true; |
| 628 dialog_args.GetBoolean("editable_user", &editable); | 627 dialog_args.GetBoolean("editable_user", &editable); |
| 629 EXPECT_FALSE(editable); | 628 EXPECT_FALSE(editable); |
| 630 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 629 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
| 631 EXPECT_TRUE(service_->user_cancelled_dialog_); | 630 EXPECT_TRUE(service_->user_cancelled_dialog_); |
| 632 EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( | 631 EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( |
| 633 prefs::kSyncHasSetupCompleted)); | 632 prefs::kSyncHasSetupCompleted)); |
| 634 } | 633 } |
| OLD | NEW |