| 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 "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 34 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 35 #include "components/policy/core/common/policy_types.h" | 35 #include "components/policy/core/common/policy_types.h" |
| 36 #include "components/policy/core/common/schema_registry.h" | 36 #include "components/policy/core/common/schema_registry.h" |
| 37 #include "components/policy/policy_constants.h" | 37 #include "components/policy/policy_constants.h" |
| 38 #include "components/policy/proto/device_management_backend.pb.h" | 38 #include "components/policy/proto/device_management_backend.pb.h" |
| 39 #include "components/prefs/pref_registry_simple.h" | 39 #include "components/prefs/pref_registry_simple.h" |
| 40 #include "components/prefs/testing_pref_service.h" | 40 #include "components/prefs/testing_pref_service.h" |
| 41 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 41 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 42 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 42 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 43 #include "components/signin/core/browser/signin_manager.h" | 43 #include "components/signin/core/browser/signin_manager.h" |
| 44 #include "components/syncable_prefs/pref_service_syncable.h" | 44 #include "components/sync_preferences/pref_service_syncable.h" |
| 45 #include "components/user_manager/fake_user_manager.h" | 45 #include "components/user_manager/fake_user_manager.h" |
| 46 #include "content/public/test/test_browser_thread_bundle.h" | 46 #include "content/public/test/test_browser_thread_bundle.h" |
| 47 #include "google_apis/gaia/gaia_auth_consumer.h" | 47 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 48 #include "google_apis/gaia/gaia_constants.h" | 48 #include "google_apis/gaia/gaia_constants.h" |
| 49 #include "google_apis/gaia/gaia_urls.h" | 49 #include "google_apis/gaia/gaia_urls.h" |
| 50 #include "net/http/http_response_headers.h" | 50 #include "net/http/http_response_headers.h" |
| 51 #include "net/url_request/test_url_fetcher_factory.h" | 51 #include "net/url_request/test_url_fetcher_factory.h" |
| 52 #include "net/url_request/url_fetcher_delegate.h" | 52 #include "net/url_request/url_fetcher_delegate.h" |
| 53 #include "net/url_request/url_request_context_getter.h" | 53 #include "net/url_request/url_request_context_getter.h" |
| 54 #include "net/url_request/url_request_status.h" | 54 #include "net/url_request/url_request_status.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // a signin Profile to use its URLRequestContext. | 95 // a signin Profile to use its URLRequestContext. |
| 96 profile_manager_.reset( | 96 profile_manager_.reset( |
| 97 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 97 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 98 ASSERT_TRUE(profile_manager_->SetUp()); | 98 ASSERT_TRUE(profile_manager_->SetUp()); |
| 99 TestingProfile::TestingFactories factories; | 99 TestingProfile::TestingFactories factories; |
| 100 factories.push_back( | 100 factories.push_back( |
| 101 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), | 101 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 102 BuildFakeProfileOAuth2TokenService)); | 102 BuildFakeProfileOAuth2TokenService)); |
| 103 profile_ = profile_manager_->CreateTestingProfile( | 103 profile_ = profile_manager_->CreateTestingProfile( |
| 104 chrome::kInitialProfile, | 104 chrome::kInitialProfile, |
| 105 std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), | 105 std::unique_ptr<sync_preferences::PrefServiceSyncable>(), |
| 106 base::UTF8ToUTF16(""), 0, std::string(), factories); | 106 base::UTF8ToUTF16(""), 0, std::string(), factories); |
| 107 // Usually the signin Profile and the main Profile are separate, but since | 107 // Usually the signin Profile and the main Profile are separate, but since |
| 108 // the signin Profile is an OTR Profile then for this test it suffices to | 108 // the signin Profile is an OTR Profile then for this test it suffices to |
| 109 // attach it to the main Profile. | 109 // attach it to the main Profile. |
| 110 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); | 110 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); |
| 111 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 111 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
| 112 | 112 |
| 113 chrome::RegisterLocalState(prefs_.registry()); | 113 chrome::RegisterLocalState(prefs_.registry()); |
| 114 | 114 |
| 115 // Set up a policy map for testing. | 115 // Set up a policy map for testing. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 598 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 599 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 599 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 600 | 600 |
| 601 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 601 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
| 602 // Running the task runner issues the initial fetch. | 602 // Running the task runner issues the initial fetch. |
| 603 FetchPolicy( | 603 FetchPolicy( |
| 604 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 604 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 605 } | 605 } |
| 606 | 606 |
| 607 } // namespace policy | 607 } // namespace policy |
| OLD | NEW |