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

Unified Diff: chrome/browser/policy/test/policy_testserver.py

Issue 342233005: Move ownership of the ComponentCloudPolicyService to the broker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/schema_registry_service_factory.cc ('k') | chromeos/chromeos_paths.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/test/policy_testserver.py
diff --git a/chrome/browser/policy/test/policy_testserver.py b/chrome/browser/policy/test/policy_testserver.py
index 81b6bd5357f9920a1736213730b8c8f99520a005..a0bd33dce2d977e000908919b6463a91c4ae6e09 100644
--- a/chrome/browser/policy/test/policy_testserver.py
+++ b/chrome/browser/policy/test/policy_testserver.py
@@ -443,10 +443,12 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.server.UpdateStateKeys(token_info['device_token'],
key_update_request.server_backed_state_key)
- # If this is a publicaccount request then get the username now and use it
- # in every PolicyFetchResponse produced. This is required to validate
- # policy for extensions in public accounts.
- username = self.server.GetPolicies().get('policy_user', None)
+ # If this is a |publicaccount| request, get the |username| now and use
+ # it in every PolicyFetchResponse produced. This is required to validate
+ # policy for extensions in device-local accounts.
+ # Unfortunately, the |username| can't be obtained from |msg| because that
+ # requires interacting with GAIA.
+ username = None
for request in msg.policy_request.request:
if request.policy_type == 'google/chromeos/publicaccount':
username = request.settings_entity_id
@@ -461,7 +463,7 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'google/chrome/user',
'google/ios/user')):
fetch_response = response.policy_response.response.add()
- self.ProcessCloudPolicy(request, token_info, fetch_response)
+ self.ProcessCloudPolicy(request, token_info, fetch_response, username)
elif request.policy_type == 'google/chrome/extension':
self.ProcessCloudPolicyForExtensions(
request, response.policy_response, token_info, username)
@@ -637,7 +639,7 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
settings.__getattribute__(field.name).CopyFrom(policy_message)
def ProcessCloudPolicyForExtensions(self, request, response, token_info,
- username):
+ username=None):
"""Handles a request for policy for extensions.
A request for policy for extensions is slightly different from the other
@@ -649,7 +651,7 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
response: The DevicePolicyResponse message for the response. Multiple
PolicyFetchResponses will be appended to this message.
token_info: The token extracted from the request.
- username: The username for the response.
+ username: The username for the response. May be None.
"""
# Send one PolicyFetchResponse for each extension that has
# configuration data at the server.
@@ -760,8 +762,6 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if username:
policy_data.username = username
- elif msg.policy_type == 'google/chromeos/publicaccount':
- policy_data.username = msg.settings_entity_id
else:
# For regular user/device policy, there is no way for the testserver to
# know the user name belonging to the GAIA auth token we received (short
« no previous file with comments | « chrome/browser/policy/schema_registry_service_factory.cc ('k') | chromeos/chromeos_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698