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

Side by Side Diff: tools/android/loading/cloud/common/clovis_task.py

Issue 1962283002: tools/android/loading Support "report" tasks in the Clovis frontend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@report
Patch Set: Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import base64 5 import base64
6 import json 6 import json
7 import uuid 7 import uuid
8 8
9 class ClovisTask(object): 9 class ClovisTask(object):
10 """Generic task, generated by the AppEngine frontend and consumed by the 10 """Generic task, generated by the AppEngine frontend and consumed by the
(...skipping 23 matching lines...) Expand all
34 """Loads a ClovisTask from a JSON string. 34 """Loads a ClovisTask from a JSON string.
35 35
36 Returns: 36 Returns:
37 ClovisTask: The task, or None if the string is invalid. 37 ClovisTask: The task, or None if the string is invalid.
38 """ 38 """
39 try: 39 try:
40 data = json.loads(json_dict) 40 data = json.loads(json_dict)
41 action = data['action'] 41 action = data['action']
42 action_params = data['action_params'] 42 action_params = data['action_params']
43 # Vaidate the format. 43 # Vaidate the format.
44 if action == 'trace': 44 if action == 'trace' or action == 'report':
45 urls = action_params['urls'] 45 urls = action_params['urls']
46 if (type(urls) is not list) or (len(urls) == 0): 46 if (type(urls) is not list) or (len(urls) == 0):
47 return None 47 return None
48 else: 48 else:
49 # When more actions are supported, check that they are valid here. 49 # When more actions are supported, check that they are valid here.
50 return None 50 return None
51 return cls(action, action_params, data.get('backend_params')) 51 return cls(action, action_params, data.get('backend_params'))
52 except Exception: 52 except Exception:
53 return None 53 return None
54 54
(...skipping 10 matching lines...) Expand all
65 65
66 def Action(self): 66 def Action(self):
67 return self._action 67 return self._action
68 68
69 def ActionParams(self): 69 def ActionParams(self):
70 return self._action_params 70 return self._action_params
71 71
72 def BackendParams(self): 72 def BackendParams(self):
73 return self._backend_params 73 return self._backend_params
74 74
OLDNEW
« no previous file with comments | « no previous file | tools/android/loading/cloud/frontend/README.md » ('j') | tools/android/loading/cloud/frontend/README.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698