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

Side by Side Diff: chrome/browser/policy/test/policy_testserver.py

Issue 1889213002: Revert of Add enterprise enrollment support for fake users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 8 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 """A bare-bones test server for testing cloud policy support. 5 """A bare-bones test server for testing cloud policy support.
6 6
7 This implements a simple cloud policy test server that can be used to test 7 This implements a simple cloud policy test server that can be used to test
8 chrome's device management service client. The policy information is read from 8 chrome's device management service client. The policy information is read from
9 the file named device_management in the server's data directory. It contains 9 the file named device_management in the server's data directory. It contains
10 enforced and recommended policies for the device and user scope, and a list 10 enforced and recommended policies for the device and user scope, and a list
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 elif request_type == 'policy': 301 elif request_type == 'policy':
302 response = self.ProcessPolicy(rmsg, request_type) 302 response = self.ProcessPolicy(rmsg, request_type)
303 elif request_type == 'enterprise_check': 303 elif request_type == 'enterprise_check':
304 response = self.ProcessAutoEnrollment(rmsg.auto_enrollment_request) 304 response = self.ProcessAutoEnrollment(rmsg.auto_enrollment_request)
305 elif request_type == 'device_state_retrieval': 305 elif request_type == 'device_state_retrieval':
306 response = self.ProcessDeviceStateRetrievalRequest( 306 response = self.ProcessDeviceStateRetrievalRequest(
307 rmsg.device_state_retrieval_request) 307 rmsg.device_state_retrieval_request)
308 elif request_type == 'status_upload': 308 elif request_type == 'status_upload':
309 response = self.ProcessStatusUploadRequest( 309 response = self.ProcessStatusUploadRequest(
310 rmsg.device_status_report_request, rmsg.session_status_report_request) 310 rmsg.device_status_report_request, rmsg.session_status_report_request)
311 elif request_type == 'device_attribute_update_permission':
312 response = self.ProcessDeviceAttributeUpdatePermissionRequest()
313 elif request_type == 'device_attribute_update':
314 response = self.ProcessDeviceAttributeUpdateRequest()
315 elif request_type == 'remote_commands':
316 response = self.ProcessRemoteCommandsRequest()
317 else: 311 else:
318 return (400, 'Invalid request parameter') 312 return (400, 'Invalid request parameter')
319 313
320 if isinstance(response[1], basestring): 314 if isinstance(response[1], basestring):
321 body = response[1] 315 body = response[1]
322 elif isinstance(response[1], google.protobuf.message.Message): 316 elif isinstance(response[1], google.protobuf.message.Message):
323 self.DumpMessage('Response', response[1]) 317 self.DumpMessage('Response', response[1])
324 body = response[1].SerializeToString() 318 body = response[1].SerializeToString()
325 else: 319 else:
326 body = '' 320 body = ''
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 session_status_report_response = dm.SessionStatusReportResponse() 579 session_status_report_response = dm.SessionStatusReportResponse()
586 580
587 response = dm.DeviceManagementResponse() 581 response = dm.DeviceManagementResponse()
588 response.device_status_report_response.CopyFrom( 582 response.device_status_report_response.CopyFrom(
589 device_status_report_response) 583 device_status_report_response)
590 response.session_status_report_response.CopyFrom( 584 response.session_status_report_response.CopyFrom(
591 session_status_report_response) 585 session_status_report_response)
592 586
593 return (200, response) 587 return (200, response)
594 588
595 def ProcessDeviceAttributeUpdatePermissionRequest(self):
596 """Handles a device attribute update permission request.
597
598 Returns:
599 A tuple of HTTP status code and response data to send to the client.
600 """
601 response = dm.DeviceManagementResponse()
602 response.device_attribute_update_permission_response.result = (
603 dm.DeviceAttributeUpdatePermissionResponse.ATTRIBUTE_UPDATE_ALLOWED)
604
605 return (200, response)
606
607 def ProcessDeviceAttributeUpdateRequest(self):
608 """Handles a device attribute update request.
609
610 Returns:
611 A tuple of HTTP status code and response data to send to the client.
612 """
613 response = dm.DeviceManagementResponse()
614 response.device_attribute_update_response.result = (
615 dm.DeviceAttributeUpdateResponse.ATTRIBUTE_UPDATE_SUCCESS)
616
617 return (200, response)
618
619 def ProcessRemoteCommandsRequest(self):
620 """Handles a remote command request.
621
622 Returns:
623 A tuple of HTTP status code and response data to send to the client.
624 """
625 return (200, '')
626
627 def SetProtobufMessageField(self, group_message, field, field_value): 589 def SetProtobufMessageField(self, group_message, field, field_value):
628 """Sets a field in a protobuf message. 590 """Sets a field in a protobuf message.
629 591
630 Args: 592 Args:
631 group_message: The protobuf message. 593 group_message: The protobuf message.
632 field: The field of the message to set, it should be a member of 594 field: The field of the message to set, it should be a member of
633 group_message.DESCRIPTOR.fields. 595 group_message.DESCRIPTOR.fields.
634 field_value: The value to set. 596 field_value: The value to set.
635 """ 597 """
636 if field.label == field.LABEL_REPEATED: 598 if field.label == field.LABEL_REPEATED:
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 if (self.options.log_to_console): 1315 if (self.options.log_to_console):
1354 logger.addHandler(logging.StreamHandler()) 1316 logger.addHandler(logging.StreamHandler())
1355 if (self.options.log_file): 1317 if (self.options.log_file):
1356 logger.addHandler(logging.FileHandler(self.options.log_file)) 1318 logger.addHandler(logging.FileHandler(self.options.log_file))
1357 1319
1358 testserver_base.TestServerRunner.run_server(self) 1320 testserver_base.TestServerRunner.run_server(self)
1359 1321
1360 1322
1361 if __name__ == '__main__': 1323 if __name__ == '__main__':
1362 sys.exit(PolicyServerRunner().main()) 1324 sys.exit(PolicyServerRunner().main())
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/wildcard_login_checker.cc ('k') | chrome/browser/resources/chromeos/login/login_shared.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698