OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/sync/one_click_signin_sync_observer.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
11 #include "chrome/browser/signin/signin_promo.h" | 11 #include "chrome/browser/signin/signin_promo.h" |
| 12 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
12 #include "chrome/browser/sync/profile_sync_service_factory.h" | 13 #include "chrome/browser/sync/profile_sync_service_factory.h" |
13 #include "chrome/browser/sync/startup_controller.h" | 14 #include "chrome/browser/sync/startup_controller.h" |
14 #include "chrome/browser/sync/test_profile_sync_service.h" | 15 #include "chrome/browser/sync/test_profile_sync_service.h" |
15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "components/signin/core/browser/signin_manager.h" | 18 #include "components/signin/core/browser/signin_manager.h" |
18 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 first_setup_in_progress_ = in_progress; | 61 first_setup_in_progress_ = in_progress; |
61 } | 62 } |
62 | 63 |
63 void set_sync_initialized(bool initialized) { | 64 void set_sync_initialized(bool initialized) { |
64 sync_initialized_ = initialized; | 65 sync_initialized_ = initialized; |
65 } | 66 } |
66 | 67 |
67 private: | 68 private: |
68 explicit OneClickTestProfileSyncService(Profile* profile) | 69 explicit OneClickTestProfileSyncService(Profile* profile) |
69 : TestProfileSyncService( | 70 : TestProfileSyncService( |
70 NULL, | 71 scoped_ptr<ProfileSyncComponentsFactory>( |
| 72 new ProfileSyncComponentsFactoryMock()), |
71 profile, | 73 profile, |
72 SigninManagerFactory::GetForProfile(profile), | 74 SigninManagerFactory::GetForProfile(profile), |
73 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 75 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
74 browser_sync::MANUAL_START), | 76 browser_sync::MANUAL_START), |
75 first_setup_in_progress_(false), | 77 first_setup_in_progress_(false), |
76 sync_initialized_(false) {} | 78 sync_initialized_(false) {} |
77 | 79 |
78 bool first_setup_in_progress_; | 80 bool first_setup_in_progress_; |
79 bool sync_initialized_; | 81 bool sync_initialized_; |
80 }; | 82 }; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 OnSyncStateChanged_SyncConfiguredSuccessfully_SourceIsSettings) { | 232 OnSyncStateChanged_SyncConfiguredSuccessfully_SourceIsSettings) { |
231 GURL continue_url = signin::GetPromoURL(signin::SOURCE_SETTINGS, false); | 233 GURL continue_url = signin::GetPromoURL(signin::SOURCE_SETTINGS, false); |
232 CreateSyncObserver(continue_url.spec()); | 234 CreateSyncObserver(continue_url.spec()); |
233 sync_service_->set_first_setup_in_progress(false); | 235 sync_service_->set_first_setup_in_progress(false); |
234 sync_service_->set_sync_initialized(true); | 236 sync_service_->set_sync_initialized(true); |
235 | 237 |
236 EXPECT_CALL(*web_contents_observer_, AboutToNavigateRenderView(_)).Times(0); | 238 EXPECT_CALL(*web_contents_observer_, AboutToNavigateRenderView(_)).Times(0); |
237 sync_service_->NotifyObservers(); | 239 sync_service_->NotifyObservers(); |
238 EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL()); | 240 EXPECT_NE(GURL(kContinueUrl), web_contents()->GetVisibleURL()); |
239 } | 241 } |
OLD | NEW |