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

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

Issue 1140333002: Added log messages for cases of failure of open files in policy_testserver.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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 185296c137febd111c283f96cdcedbff81f97045..ef2b0ba8e8d57d7ad99948d035b8abc128ac634d 100644
--- a/chrome/browser/policy/test/policy_testserver.py
+++ b/chrome/browser/policy/test/policy_testserver.py
@@ -71,16 +71,7 @@ import tlslite.api
import tlslite.utils
import tlslite.utils.cryptomath
import urlparse
-
-# The name and availability of the json module varies in python versions.
-try:
- import simplejson as json
-except ImportError:
- try:
- import json
- except ImportError:
- json = None
-
+import json
Mattias Nissler (ping if slow) 2015/06/15 07:47:18 alphabetize
import asn1der
import testserver_base
@@ -759,6 +750,10 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if payload is None:
payload = self.CreatePolicyForExternalPolicyData(policy_key)
else:
+ if ep is None:
+ logging.error('chrome_extension_policy_pb2 does not exist')
+ if dp is None:
+ logging.error('chrome_device_policy_pb2 does not exist')
Mattias Nissler (ping if slow) 2015/06/15 07:47:18 Why not just drop the ep is None and dp is None ch
response.error_code = 400
response.error_message = 'Invalid policy type'
return
@@ -986,12 +981,12 @@ class PolicyTestServer(testserver_base.BrokenPipeHandlerMixIn,
"""
policy = {}
if json is None:
- print 'No JSON module, cannot parse policy information'
+ logging.error('No JSON module, cannot parse policy information')
else :
try:
policy = json.loads(open(self.policy_path).read(), strict=False)
except IOError:
- print 'Failed to load policy from %s' % self.policy_path
+ logging.error('Failed to load policies from %s' % self.policy_path)
return policy
def RegisterDevice(self, device_id, machine_id, type):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698