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

Side by Side Diff: tools/android/loading/test_utils.py

Issue 2018373002: Clovis: tweak test-util comment to make it accurate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """Common utilities used in unit tests, within this directory.""" 5 """Common utilities used in unit tests, within this directory."""
6 6
7 import dependency_graph 7 import dependency_graph
8 import devtools_monitor 8 import devtools_monitor
9 import loading_trace 9 import loading_trace
10 import page_track 10 import page_track
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 # connectEnd should be ignored. 129 # connectEnd should be ignored.
130 'connectEnd': (end_time - start_time) / 2, 130 'connectEnd': (end_time - start_time) / 2,
131 'receiveHeadersEnd': headers_time - start_time, 131 'receiveHeadersEnd': headers_time - start_time,
132 'loadingFinished': end_time - start_time, 132 'loadingFinished': end_time - start_time,
133 'requestTime': start_time / 1000.0} 133 'requestTime': start_time / 1000.0}
134 return MakeRequestWithTiming( 134 return MakeRequestWithTiming(
135 url, source_url, timing_dict, magic_content_type, initiator_type) 135 url, source_url, timing_dict, magic_content_type, initiator_type)
136 136
137 137
138 def LoadingTraceFromEvents(requests, page_events=None, trace_events=None): 138 def LoadingTraceFromEvents(requests, page_events=None, trace_events=None):
139 """Returns a LoadingTrace instance from a list of requests and page events.""" 139 """Returns a LoadingTrace instance from various events."""
140 request = FakeRequestTrack(requests) 140 request = FakeRequestTrack(requests)
141 page_event_track = FakePageTrack(page_events if page_events else []) 141 page_event_track = FakePageTrack(page_events if page_events else [])
142 if trace_events is not None: 142 if trace_events is not None:
143 tracing_track = tracing.TracingTrack(None) 143 tracing_track = tracing.TracingTrack(None)
144 tracing_track.Handle('Tracing.dataCollected', 144 tracing_track.Handle('Tracing.dataCollected',
145 {'params': {'value': [e for e in trace_events]}}) 145 {'params': {'value': [e for e in trace_events]}})
146 else: 146 else:
147 tracing_track = None 147 tracing_track = None
148 return loading_trace.LoadingTrace( 148 return loading_trace.LoadingTrace(
149 None, None, page_event_track, request, tracing_track) 149 None, None, page_event_track, request, tracing_track)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 self._request_index += 1 246 self._request_index += 1
247 return rq 247 return rq
248 248
249 def CreateTrace(self, requests, events, main_frame_id): 249 def CreateTrace(self, requests, events, main_frame_id):
250 page_event = {'method': 'Page.frameStartedLoading', 250 page_event = {'method': 'Page.frameStartedLoading',
251 'frame_id': main_frame_id} 251 'frame_id': main_frame_id}
252 trace = LoadingTraceFromEvents( 252 trace = LoadingTraceFromEvents(
253 requests, trace_events=events, page_events=[page_event]) 253 requests, trace_events=events, page_events=[page_event])
254 trace.tracing_track.SetMainFrameID(main_frame_id) 254 trace.tracing_track.SetMainFrameID(main_frame_id)
255 return trace 255 return trace
OLDNEW
« 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