Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/sync/sync_setup_wizard_unittest.cc

Issue 8596017: sync: rename ProfileSyncFactory to ProfileSyncComponentsFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/sync/profile_sync_factory_mock.h" 12 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/signin_manager.h" 14 #include "chrome/browser/sync/signin_manager.h"
15 #include "chrome/browser/sync/sync_setup_flow.h" 15 #include "chrome/browser/sync/sync_setup_flow.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h" 18 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h"
19 #include "chrome/common/net/gaia/google_service_auth_error.h" 19 #include "chrome/common/net/gaia/google_service_auth_error.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/browser_with_test_window_test.h" 21 #include "chrome/test/base/browser_with_test_window_test.h"
22 #include "chrome/test/base/test_browser_window.h" 22 #include "chrome/test/base/test_browser_window.h"
(...skipping 28 matching lines...) Expand all
51 ShowSetupDone(string16()); 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(ProfileSyncComponentsFactory* factory,
62 Profile* profile)
62 : ProfileSyncService(factory, profile, new SigninManager(), ""), 63 : ProfileSyncService(factory, profile, new SigninManager(), ""),
63 user_cancelled_dialog_(false), 64 user_cancelled_dialog_(false),
64 is_using_secondary_passphrase_(false), 65 is_using_secondary_passphrase_(false),
65 encrypt_everything_(false) { 66 encrypt_everything_(false) {
66 ResetTestStats(); 67 ResetTestStats();
67 } 68 }
68 69
69 virtual ~ProfileSyncServiceForWizardTest() {} 70 virtual ~ProfileSyncServiceForWizardTest() {}
70 71
71 virtual void OnUserSubmittedAuth(const std::string& username, 72 virtual void OnUserSubmittedAuth(const std::string& username,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 class TestingProfileWithSyncService : public TestingProfile { 177 class TestingProfileWithSyncService : public TestingProfile {
177 public: 178 public:
178 TestingProfileWithSyncService() { 179 TestingProfileWithSyncService() {
179 sync_service_.reset(new ProfileSyncServiceForWizardTest(&factory_, this)); 180 sync_service_.reset(new ProfileSyncServiceForWizardTest(&factory_, this));
180 } 181 }
181 182
182 virtual ProfileSyncService* GetProfileSyncService() { 183 virtual ProfileSyncService* GetProfileSyncService() {
183 return sync_service_.get(); 184 return sync_service_.get();
184 } 185 }
185 private: 186 private:
186 ProfileSyncFactoryMock factory_; 187 ProfileSyncComponentsFactoryMock factory_;
187 scoped_ptr<ProfileSyncService> sync_service_; 188 scoped_ptr<ProfileSyncService> sync_service_;
188 }; 189 };
189 190
190 // TODO(jhawkins): Subclass Browser (specifically, ShowOptionsTab) and inject it 191 // TODO(jhawkins): Subclass Browser (specifically, ShowOptionsTab) and inject it
191 // here to test the visibility of the Sync UI. 192 // here to test the visibility of the Sync UI.
192 class SyncSetupWizardTest : public BrowserWithTestWindowTest { 193 class SyncSetupWizardTest : public BrowserWithTestWindowTest {
193 public: 194 public:
194 SyncSetupWizardTest() 195 SyncSetupWizardTest()
195 : wizard_(NULL), 196 : wizard_(NULL),
196 service_(NULL), 197 service_(NULL),
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 609
609 service_->set_last_auth_error( 610 service_->set_last_auth_error(
610 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); 611 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE));
611 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); 612 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR);
612 AttachSyncSetupHandler(); 613 AttachSyncSetupHandler();
613 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); 614 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_);
614 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); 615 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_);
615 CloseSetupUI(); 616 CloseSetupUI();
616 EXPECT_FALSE(wizard_->IsVisible()); 617 EXPECT_FALSE(wizard_->IsVisible());
617 } 618 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698