| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 26 #include "chrome/test/base/testing_browser_process.h" | 26 #include "chrome/test/base/testing_browser_process.h" |
| 27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "chrome/test/base/testing_profile_manager.h" | 28 #include "chrome/test/base/testing_profile_manager.h" |
| 29 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 29 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
| 30 #include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h
" | 30 #include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h
" |
| 31 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 31 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
| 32 #include "components/policy/core/common/cloud/mock_device_management_service.h" | 32 #include "components/policy/core/common/cloud/mock_device_management_service.h" |
| 33 #include "components/policy/core/common/external_data_fetcher.h" | 33 #include "components/policy/core/common/external_data_fetcher.h" |
| 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" | |
| 36 #include "components/policy/core/common/schema_registry.h" | 35 #include "components/policy/core/common/schema_registry.h" |
| 37 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 36 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 38 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 39 #include "components/signin/core/browser/signin_manager.h" | 38 #include "components/signin/core/browser/signin_manager.h" |
| 40 #include "components/syncable_prefs/pref_service_syncable.h" | 39 #include "components/syncable_prefs/pref_service_syncable.h" |
| 41 #include "components/user_manager/fake_user_manager.h" | 40 #include "components/user_manager/fake_user_manager.h" |
| 42 #include "content/public/test/test_browser_thread_bundle.h" | 41 #include "content/public/test/test_browser_thread_bundle.h" |
| 43 #include "google_apis/gaia/gaia_auth_consumer.h" | 42 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 44 #include "google_apis/gaia/gaia_constants.h" | 43 #include "google_apis/gaia/gaia_constants.h" |
| 45 #include "google_apis/gaia/gaia_urls.h" | 44 #include "google_apis/gaia/gaia_urls.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // the signin Profile is an OTR Profile then for this test it suffices to | 107 // the signin Profile is an OTR Profile then for this test it suffices to |
| 109 // attach it to the main Profile. | 108 // attach it to the main Profile. |
| 110 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); | 109 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); |
| 111 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 110 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
| 112 | 111 |
| 113 chrome::RegisterLocalState(prefs_.registry()); | 112 chrome::RegisterLocalState(prefs_.registry()); |
| 114 | 113 |
| 115 // Set up a policy map for testing. | 114 // Set up a policy map for testing. |
| 116 policy_map_.Set(key::kHomepageLocation, | 115 policy_map_.Set(key::kHomepageLocation, |
| 117 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 116 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 118 POLICY_SOURCE_CLOUD, | |
| 119 new base::StringValue("http://chromium.org"), | 117 new base::StringValue("http://chromium.org"), |
| 120 NULL); | 118 NULL); |
| 121 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, | 119 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, |
| 122 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 120 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 123 POLICY_SOURCE_ENTERPRISE_DEFAULT, | |
| 124 new base::StringValue("primary-only"), | 121 new base::StringValue("primary-only"), |
| 125 NULL); | 122 NULL); |
| 126 policy_map_.Set(key::kEasyUnlockAllowed, | 123 policy_map_.Set(key::kEasyUnlockAllowed, |
| 127 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 124 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 128 POLICY_SOURCE_CLOUD, | |
| 129 new base::FundamentalValue(false), | 125 new base::FundamentalValue(false), |
| 130 NULL); | 126 NULL); |
| 131 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, | 127 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, |
| 132 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 128 POLICY_LEVEL_MANDATORY, |
| 133 POLICY_SOURCE_CLOUD, | 129 POLICY_SCOPE_USER, |
| 134 new base::FundamentalValue(false), | 130 new base::FundamentalValue(false), |
| 135 NULL); | 131 NULL); |
| 136 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 132 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| 137 .CopyFrom(policy_map_); | 133 .CopyFrom(policy_map_); |
| 138 | 134 |
| 139 // Create fake policy blobs to deliver to the client. | 135 // Create fake policy blobs to deliver to the client. |
| 140 em::DeviceRegisterResponse* register_response = | 136 em::DeviceRegisterResponse* register_response = |
| 141 register_blob_.mutable_register_response(); | 137 register_blob_.mutable_register_response(); |
| 142 register_response->set_device_management_token("dmtoken123"); | 138 register_response->set_device_management_token("dmtoken123"); |
| 143 | 139 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 588 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 593 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 589 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 594 | 590 |
| 595 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 591 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
| 596 // Running the task runner issues the initial fetch. | 592 // Running the task runner issues the initial fetch. |
| 597 FetchPolicy( | 593 FetchPolicy( |
| 598 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 594 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 599 } | 595 } |
| 600 | 596 |
| 601 } // namespace policy | 597 } // namespace policy |
| OLD | NEW |