| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 13 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" | 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
| 15 #include "chrome/browser/prefs/browser_prefs.h" | 15 #include "chrome/browser/prefs/browser_prefs.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 17 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
| 18 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 18 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 19 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 19 #include "chrome/browser/signin/fake_account_fetcher_service.h" | 20 #include "chrome/browser/signin/fake_account_fetcher_service.h" |
| 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 21 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 21 #include "chrome/browser/signin/fake_signin_manager.h" | 22 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/signin/test_signin_client_builder.h" | 25 #include "chrome/browser/signin/test_signin_client_builder.h" |
| 25 #include "chrome/test/base/testing_browser_process.h" | 26 #include "chrome/test/base/testing_browser_process.h" |
| 26 #include "chrome/test/base/testing_pref_service_syncable.h" | 27 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 27 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
| 28 #include "components/policy/core/browser/browser_policy_connector.h" | 29 #include "components/policy/core/browser/browser_policy_connector.h" |
| 29 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 30 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
| 30 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 31 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 31 #include "components/policy/core/common/cloud/mock_device_management_service.h" | 32 #include "components/policy/core/common/cloud/mock_device_management_service.h" |
| 32 #include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h" | 33 #include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h" |
| 33 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 34 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 34 #include "components/policy/core/common/schema_registry.h" | 35 #include "components/policy/core/common/schema_registry.h" |
| 35 #include "components/signin/core/browser/account_tracker_service.h" | 36 #include "components/signin/core/browser/account_tracker_service.h" |
| 36 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 38 #include "components/signin/core/browser/fake_signin_manager.h" |
| 37 #include "components/signin/core/browser/signin_manager.h" | 39 #include "components/signin/core/browser/signin_manager.h" |
| 38 #include "content/public/browser/browser_context.h" | 40 #include "content/public/browser/browser_context.h" |
| 39 #include "content/public/browser/notification_details.h" | 41 #include "content/public/browser/notification_details.h" |
| 40 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/notification_source.h" | 43 #include "content/public/browser/notification_source.h" |
| 42 #include "content/public/test/test_browser_thread_bundle.h" | 44 #include "content/public/test/test_browser_thread_bundle.h" |
| 43 #include "google_apis/gaia/gaia_constants.h" | 45 #include "google_apis/gaia/gaia_constants.h" |
| 44 #include "google_apis/gaia/google_service_auth_error.h" | 46 #include "google_apis/gaia/google_service_auth_error.h" |
| 45 #include "net/http/http_status_code.h" | 47 #include "net/http/http_status_code.h" |
| 46 #include "net/url_request/test_url_fetcher_factory.h" | 48 #include "net/url_request/test_url_fetcher_factory.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #endif | 81 #endif |
| 80 | 82 |
| 81 const char kHostedDomainResponse[] = | 83 const char kHostedDomainResponse[] = |
| 82 "{" | 84 "{" |
| 83 " \"hd\": \"test.com\"" | 85 " \"hd\": \"test.com\"" |
| 84 "}"; | 86 "}"; |
| 85 | 87 |
| 86 class SigninManagerFake : public FakeSigninManager { | 88 class SigninManagerFake : public FakeSigninManager { |
| 87 public: | 89 public: |
| 88 explicit SigninManagerFake(Profile* profile) | 90 explicit SigninManagerFake(Profile* profile) |
| 89 : FakeSigninManager(profile) { | 91 : FakeSigninManager( |
| 92 ChromeSigninClientFactory::GetForProfile(profile), |
| 93 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 94 AccountTrackerServiceFactory::GetForProfile(profile), |
| 95 GaiaCookieManagerServiceFactory::GetForProfile(profile)) { |
| 90 Initialize(NULL); | 96 Initialize(NULL); |
| 91 } | 97 } |
| 92 | 98 |
| 93 void ForceSignOut() { | 99 void ForceSignOut() { |
| 94 // Allow signing out now. | 100 // Allow signing out now. |
| 95 prohibit_signout_ = false; | 101 prohibit_signout_ = false; |
| 96 SignOut(signin_metrics::SIGNOUT_TEST); | 102 SignOut(signin_metrics::SIGNOUT_TEST); |
| 97 } | 103 } |
| 98 | 104 |
| 99 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile) { | 105 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile) { |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 base::RunLoop().RunUntilIdle(); | 838 base::RunLoop().RunUntilIdle(); |
| 833 EXPECT_FALSE(manager_->IsClientRegistered()); | 839 EXPECT_FALSE(manager_->IsClientRegistered()); |
| 834 #if !defined(OS_ANDROID) | 840 #if !defined(OS_ANDROID) |
| 835 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); | 841 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); |
| 836 #endif | 842 #endif |
| 837 } | 843 } |
| 838 | 844 |
| 839 } // namespace | 845 } // namespace |
| 840 | 846 |
| 841 } // namespace policy | 847 } // namespace policy |
| OLD | NEW |