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