OLD | NEW |
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 copy | 5 import copy |
6 import json | 6 import json |
7 import os | 7 import os |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import tempfile | 10 import tempfile |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 {'cat': _MEM_CAT, 'name': 'periodic_interval', 'pid': 1, 'ph': 'v', | 46 {'cat': _MEM_CAT, 'name': 'periodic_interval', 'pid': 1, 'ph': 'v', |
47 'ts': 1, 'args': {'dumps': {'allocators': {'malloc': {'attrs': {'size':{ | 47 'ts': 1, 'args': {'dumps': {'allocators': {'malloc': {'attrs': {'size':{ |
48 'units': 'bytes', 'value': 'd704', }}}}}}}, | 48 'units': 'bytes', 'value': 'd704', }}}}}}}, |
49 {'ph': 'M', 'cat': '__metadata', 'pid': 1, 'name': 'process_name', 'ts': 1, | 49 {'ph': 'M', 'cat': '__metadata', 'pid': 1, 'name': 'process_name', 'ts': 1, |
50 'args': {'name': 'Browser'}}] | 50 'args': {'name': 'Browser'}}] |
51 | 51 |
52 | 52 |
53 def TracingTrack(events): | 53 def TracingTrack(events): |
54 return tracing.TracingTrack.FromJsonDict({ | 54 return tracing.TracingTrack.FromJsonDict({ |
55 'events': events, | 55 'events': events, |
56 'categories': (tracing.INITIAL_CATEGORIES + | 56 'categories': (sandwich_runner._TRACING_CATEGORIES + |
57 (sandwich_runner.MEMORY_DUMP_CATEGORY,))}) | 57 [sandwich_runner.MEMORY_DUMP_CATEGORY])}) |
58 | 58 |
59 | 59 |
60 def LoadingTrace(events): | 60 def LoadingTrace(events): |
61 return loading_trace.LoadingTrace('http://a.com/', {}, | 61 return loading_trace.LoadingTrace('http://a.com/', {}, |
62 page_track.PageTrack(None), | 62 page_track.PageTrack(None), |
63 request_track.RequestTrack(None), | 63 request_track.RequestTrack(None), |
64 TracingTrack(events)) | 64 TracingTrack(events)) |
65 | 65 |
66 | 66 |
67 class PageTrackTest(unittest.TestCase): | 67 class PageTrackTest(unittest.TestCase): |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 point(200, 0.6), | 249 point(200, 0.6), |
250 point(150, 0.3), | 250 point(150, 0.3), |
251 point(230, 1.0), | 251 point(230, 1.0), |
252 ] | 252 ] |
253 with self.assertRaises(ValueError): | 253 with self.assertRaises(ValueError): |
254 puller._ComputeSpeedIndex(completness_record) | 254 puller._ComputeSpeedIndex(completness_record) |
255 | 255 |
256 | 256 |
257 if __name__ == '__main__': | 257 if __name__ == '__main__': |
258 unittest.main() | 258 unittest.main() |
OLD | NEW |