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