Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // the signin Profile is an OTR Profile then for this test it suffices to 105 // the signin Profile is an OTR Profile then for this test it suffices to
105 // attach it to the main Profile. 106 // attach it to the main Profile.
106 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); 107 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_);
107 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); 108 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile());
108 109
109 chrome::RegisterLocalState(prefs_.registry()); 110 chrome::RegisterLocalState(prefs_.registry());
110 111
111 // Set up a policy map for testing. 112 // Set up a policy map for testing.
112 policy_map_.Set(key::kHomepageLocation, 113 policy_map_.Set(key::kHomepageLocation,
113 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 114 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
115 POLICY_SOURCE_CLOUD,
114 new base::StringValue("http://chromium.org"), 116 new base::StringValue("http://chromium.org"),
115 NULL); 117 NULL);
116 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, 118 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior,
117 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 119 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
120 POLICY_SOURCE_ENTERPRISE_DEFAULT,
118 new base::StringValue("primary-only"), 121 new base::StringValue("primary-only"),
119 NULL); 122 NULL);
120 policy_map_.Set(key::kEasyUnlockAllowed, 123 policy_map_.Set(key::kEasyUnlockAllowed,
121 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 124 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
125 POLICY_SOURCE_CLOUD,
122 new base::FundamentalValue(false), 126 new base::FundamentalValue(false),
123 NULL); 127 NULL);
124 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, 128 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy,
125 POLICY_LEVEL_MANDATORY, 129 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
126 POLICY_SCOPE_USER, 130 POLICY_SOURCE_CLOUD,
127 new base::FundamentalValue(false), 131 new base::FundamentalValue(false),
128 NULL); 132 NULL);
129 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 133 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
130 .CopyFrom(policy_map_); 134 .CopyFrom(policy_map_);
131 135
132 // Create fake policy blobs to deliver to the client. 136 // Create fake policy blobs to deliver to the client.
133 em::DeviceRegisterResponse* register_response = 137 em::DeviceRegisterResponse* register_response =
134 register_blob_.mutable_register_response(); 138 register_blob_.mutable_register_response();
135 register_response->set_device_management_token("dmtoken123"); 139 register_response->set_device_management_token("dmtoken123");
136 140
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 589 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
586 EXPECT_TRUE(manager_->core()->client()->is_registered()); 590 EXPECT_TRUE(manager_->core()->client()->is_registered());
587 591
588 // The refresh scheduler takes care of the initial fetch for unmanaged users. 592 // The refresh scheduler takes care of the initial fetch for unmanaged users.
589 // Running the task runner issues the initial fetch. 593 // Running the task runner issues the initial fetch.
590 FetchPolicy( 594 FetchPolicy(
591 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); 595 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_));
592 } 596 }
593 597
594 } // namespace policy 598 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698