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

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

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
11 #include "chrome/browser/browser_list.h" 11 #include "chrome/browser/browser_list.h"
12 #include "chrome/browser/google_service_auth_error.h" 12 #include "chrome/browser/google_service_auth_error.h"
13 #include "chrome/browser/pref_service.h" 13 #include "chrome/browser/pref_service.h"
14 #include "chrome/browser/sync/profile_sync_factory_mock.h" 14 #include "chrome/browser/sync/profile_sync_factory_mock.h"
15 #include "chrome/browser/sync/profile_sync_service.h" 15 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/sync_setup_flow.h" 16 #include "chrome/browser/sync/sync_setup_flow.h"
17 #include "chrome/common/net/fake_network_change_notifier_thread.h"
18 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
19 #include "chrome/test/browser_with_test_window_test.h" 18 #include "chrome/test/browser_with_test_window_test.h"
20 #include "chrome/test/testing_profile.h" 19 #include "chrome/test/testing_profile.h"
21 #include "chrome/test/test_browser_window.h" 20 #include "chrome/test/test_browser_window.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 static const char kTestUser[] = "chrome.p13n.test@gmail.com"; 23 static const char kTestUser[] = "chrome.p13n.test@gmail.com";
25 static const char kTestPassword[] = "passwd"; 24 static const char kTestPassword[] = "passwd";
26 static const char kTestCaptcha[] = "pizzamyheart"; 25 static const char kTestCaptcha[] = "pizzamyheart";
27 static const char kTestCaptchaUrl[] = "http://pizzamyheart/"; 26 static const char kTestCaptchaUrl[] = "http://pizzamyheart/";
28 27
29 typedef GoogleServiceAuthError AuthError; 28 typedef GoogleServiceAuthError AuthError;
30 29
31 // A PSS subtype to inject. 30 // A PSS subtype to inject.
32 class ProfileSyncServiceForWizardTest : public ProfileSyncService { 31 class ProfileSyncServiceForWizardTest : public ProfileSyncService {
33 public: 32 public:
34 ProfileSyncServiceForWizardTest(ProfileSyncFactory* factory, Profile* profile) 33 ProfileSyncServiceForWizardTest(ProfileSyncFactory* factory, Profile* profile)
35 : ProfileSyncService(factory, profile, 34 : ProfileSyncService(factory, profile, false),
36 &fake_network_change_notifier_thread_,
37 false),
38 user_accepted_merge_and_sync_(false), 35 user_accepted_merge_and_sync_(false),
39 user_cancelled_dialog_(false) { 36 user_cancelled_dialog_(false) {
40 RegisterPreferences(); 37 RegisterPreferences();
41 } 38 }
42 39
43 virtual ~ProfileSyncServiceForWizardTest() { } 40 virtual ~ProfileSyncServiceForWizardTest() { }
44 41
45 virtual void OnUserSubmittedAuth(const std::string& username, 42 virtual void OnUserSubmittedAuth(const std::string& username,
46 const std::string& password, 43 const std::string& password,
47 const std::string& captcha) { 44 const std::string& captcha) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 std::string username_; 84 std::string username_;
88 std::string password_; 85 std::string password_;
89 std::string captcha_; 86 std::string captcha_;
90 bool user_accepted_merge_and_sync_; 87 bool user_accepted_merge_and_sync_;
91 bool user_cancelled_dialog_; 88 bool user_cancelled_dialog_;
92 bool user_chose_data_types_; 89 bool user_chose_data_types_;
93 bool keep_everything_synced_; 90 bool keep_everything_synced_;
94 syncable::ModelTypeSet chosen_data_types_; 91 syncable::ModelTypeSet chosen_data_types_;
95 92
96 private: 93 private:
97 chrome_common_net::FakeNetworkChangeNotifierThread
98 fake_network_change_notifier_thread_;
99
100 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest); 94 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceForWizardTest);
101 }; 95 };
102 96
103 class TestingProfileWithSyncService : public TestingProfile { 97 class TestingProfileWithSyncService : public TestingProfile {
104 public: 98 public:
105 TestingProfileWithSyncService() { 99 TestingProfileWithSyncService() {
106 sync_service_.reset(new ProfileSyncServiceForWizardTest(&factory_, this)); 100 sync_service_.reset(new ProfileSyncServiceForWizardTest(&factory_, this));
107 } 101 }
108 102
109 virtual ProfileSyncService* GetProfileSyncService() { 103 virtual ProfileSyncService* GetProfileSyncService() {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 int error = -1; 433 int error = -1;
440 dialog_args.GetInteger(L"error", &error); 434 dialog_args.GetInteger(L"error", &error);
441 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error); 435 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
442 service_->set_auth_state(kTestUser, AuthError::None()); 436 service_->set_auth_state(kTestUser, AuthError::None());
443 437
444 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 438 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
445 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 439 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
446 } 440 }
447 441
448 #undef SKIP_TEST_ON_MACOSX 442 #undef SKIP_TEST_ON_MACOSX
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698