| 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" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
| 13 #include "chrome/browser/prefs/testing_pref_store.h" |
| 12 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 14 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/browser/sync/signin_manager.h" | 16 #include "chrome/browser/sync/signin_manager.h" |
| 15 #include "chrome/browser/sync/sync_setup_flow.h" | 17 #include "chrome/browser/sync/sync_setup_flow.h" |
| 16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h" | 20 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h" |
| 19 #include "chrome/common/net/gaia/google_service_auth_error.h" | 21 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 20 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/test/base/browser_with_test_window_test.h" | 23 #include "chrome/test/base/browser_with_test_window_test.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 SyncSetupWizardTest() | 197 SyncSetupWizardTest() |
| 196 : wizard_(NULL), | 198 : wizard_(NULL), |
| 197 service_(NULL), | 199 service_(NULL), |
| 198 flow_(NULL) {} | 200 flow_(NULL) {} |
| 199 virtual ~SyncSetupWizardTest() {} | 201 virtual ~SyncSetupWizardTest() {} |
| 200 virtual void SetUp() { | 202 virtual void SetUp() { |
| 201 set_profile(new TestingProfileWithSyncService()); | 203 set_profile(new TestingProfileWithSyncService()); |
| 202 profile()->CreateBookmarkModel(false); | 204 profile()->CreateBookmarkModel(false); |
| 203 // Wait for the bookmarks model to load. | 205 // Wait for the bookmarks model to load. |
| 204 profile()->BlockUntilBookmarkModelLoaded(); | 206 profile()->BlockUntilBookmarkModelLoaded(); |
| 207 PrefService* prefs = profile()->GetPrefs(); |
| 208 prefs->SetString(prefs::kGoogleServicesUsername, kTestUser); |
| 209 |
| 205 set_browser(new Browser(Browser::TYPE_TABBED, profile())); | 210 set_browser(new Browser(Browser::TYPE_TABBED, profile())); |
| 206 browser()->set_window(window()); | 211 browser()->set_window(window()); |
| 207 BrowserList::SetLastActive(browser()); | 212 BrowserList::SetLastActive(browser()); |
| 208 service_ = static_cast<ProfileSyncServiceForWizardTest*>( | 213 service_ = static_cast<ProfileSyncServiceForWizardTest*>( |
| 209 profile()->GetProfileSyncService()); | 214 profile()->GetProfileSyncService()); |
| 210 wizard_ = service_->GetWizard(); | 215 wizard_ = service_->GetWizard(); |
| 211 } | 216 } |
| 212 | 217 |
| 213 virtual void TearDown() { | 218 virtual void TearDown() { |
| 214 wizard_ = NULL; | 219 wizard_ = NULL; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 614 |
| 610 service_->set_last_auth_error( | 615 service_->set_last_auth_error( |
| 611 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); | 616 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); |
| 612 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); | 617 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); |
| 613 AttachSyncSetupHandler(); | 618 AttachSyncSetupHandler(); |
| 614 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); | 619 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); |
| 615 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); | 620 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); |
| 616 CloseSetupUI(); | 621 CloseSetupUI(); |
| 617 EXPECT_FALSE(wizard_->IsVisible()); | 622 EXPECT_FALSE(wizard_->IsVisible()); |
| 618 } | 623 } |
| OLD | NEW |