| 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 17 matching lines...) Expand all Loading... |
| 28 static const char kTestCaptcha[] = "pizzamyheart"; | 28 static const char kTestCaptcha[] = "pizzamyheart"; |
| 29 static const char kTestCaptchaUrl[] = "http://pizzamyheart/"; | 29 static const char kTestCaptchaUrl[] = "http://pizzamyheart/"; |
| 30 | 30 |
| 31 typedef GoogleServiceAuthError AuthError; | 31 typedef GoogleServiceAuthError AuthError; |
| 32 | 32 |
| 33 class MockSyncSetupHandler : public OptionsSyncSetupHandler { | 33 class MockSyncSetupHandler : public OptionsSyncSetupHandler { |
| 34 public: | 34 public: |
| 35 MockSyncSetupHandler() : OptionsSyncSetupHandler(NULL) {} | 35 MockSyncSetupHandler() : OptionsSyncSetupHandler(NULL) {} |
| 36 | 36 |
| 37 // SyncSetupFlowHandler implementation. | 37 // SyncSetupFlowHandler implementation. |
| 38 virtual void ShowGaiaLogin(const DictionaryValue& args) {} | 38 virtual void ShowGaiaLogin(const DictionaryValue& args) OVERRIDE {} |
| 39 virtual void ShowGaiaSuccessAndClose() { | 39 virtual void ShowGaiaSuccessAndClose() OVERRIDE { |
| 40 flow()->OnDialogClosed(""); | 40 flow()->OnDialogClosed(""); |
| 41 } | 41 } |
| 42 virtual void ShowGaiaSuccessAndSettingUp() {} | 42 virtual void ShowGaiaSuccessAndSettingUp() OVERRIDE {} |
| 43 virtual void ShowConfigure(const DictionaryValue& args) {} | 43 virtual void ShowConfigure(const DictionaryValue& args) OVERRIDE {} |
| 44 virtual void ShowPassphraseEntry(const DictionaryValue& args) {} | 44 virtual void ShowPassphraseEntry(const DictionaryValue& args) OVERRIDE {} |
| 45 virtual void ShowSettingUp() {} | 45 virtual void ShowSettingUp() OVERRIDE {} |
| 46 virtual void ShowSetupDone(const std::wstring& user) { | 46 virtual void ShowSetupDone(const string16& user) OVERRIDE { |
| 47 flow()->OnDialogClosed(""); | 47 flow()->OnDialogClosed(""); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void CloseSetupUI() { | 50 void CloseSetupUI() { |
| 51 ShowSetupDone(std::wstring()); | 51 ShowSetupDone(string16()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(MockSyncSetupHandler); | 55 DISALLOW_COPY_AND_ASSIGN(MockSyncSetupHandler); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // A PSS subtype to inject. | 58 // A PSS subtype to inject. |
| 59 class ProfileSyncServiceForWizardTest : public ProfileSyncService { | 59 class ProfileSyncServiceForWizardTest : public ProfileSyncService { |
| 60 public: | 60 public: |
| 61 ProfileSyncServiceForWizardTest(ProfileSyncFactory* factory, Profile* profile) | 61 ProfileSyncServiceForWizardTest(ProfileSyncFactory* factory, Profile* profile) |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 608 |
| 609 service_->set_last_auth_error( | 609 service_->set_last_auth_error( |
| 610 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); | 610 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); |
| 611 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); | 611 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); |
| 612 AttachSyncSetupHandler(); | 612 AttachSyncSetupHandler(); |
| 613 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); | 613 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); |
| 614 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); | 614 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); |
| 615 CloseSetupUI(); | 615 CloseSetupUI(); |
| 616 EXPECT_FALSE(wizard_->IsVisible()); | 616 EXPECT_FALSE(wizard_->IsVisible()); |
| 617 } | 617 } |
| OLD | NEW |