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

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

Issue 2103673003: tools/android/loading: Properly detect page loading failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 """Monitor tracing events on chrome via chrome remote debugging.""" 5 """Monitor tracing events on chrome via chrome remote debugging."""
6 6
7 import itertools 7 import itertools
8 import logging 8 import logging
9 import operator 9 import operator
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 def GetMatchingMainFrameEvents(self, category, name): 80 def GetMatchingMainFrameEvents(self, category, name):
81 """Gets events matching |category| and |name| that occur in the main frame. 81 """Gets events matching |category| and |name| that occur in the main frame.
82 82
83 Events without a 'frame' key in their |args| are discarded. 83 Events without a 'frame' key in their |args| are discarded.
84 """ 84 """
85 matching_events = self.GetMatchingEvents(category, name) 85 matching_events = self.GetMatchingEvents(category, name)
86 return [e for e in matching_events 86 return [e for e in matching_events
87 if 'frame' in e.args and e.args['frame'] == self.GetMainFrameID()] 87 if 'frame' in e.args and e.args['frame'] == self.GetMainFrameID()]
88 88
89 def GetMainFrameRoutingID(self):
90 """Returns the main frame routing ID."""
91 for event in self.GetMatchingEvents(
92 'navigation', 'RenderFrameImpl::OnNavigate'):
93 return event.args['id']
94 assert False
95
89 def GetMainFrameID(self): 96 def GetMainFrameID(self):
90 """Returns the main frame ID.""" 97 """Returns the main frame ID."""
91 if not self._main_frame_id: 98 if not self._main_frame_id:
92 navigation_start_events = self.GetMatchingEvents( 99 navigation_start_events = self.GetMatchingEvents(
93 'blink.user_timing', 'navigationStart') 100 'blink.user_timing', 'navigationStart')
94 first_event = min(navigation_start_events, key=lambda e: e.start_msec) 101 first_event = min(navigation_start_events, key=lambda e: e.start_msec)
95 self._main_frame_id = first_event.args['frame'] 102 self._main_frame_id = first_event.args['frame']
96 103
97 return self._main_frame_id 104 return self._main_frame_id
98 105
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 self._left = _IntervalTree(self.start, left_end, left_events) 549 self._left = _IntervalTree(self.start, left_end, left_events)
543 self._right = _IntervalTree(right_start, self.end, right_events) 550 self._right = _IntervalTree(right_start, self.end, right_events)
544 551
545 def _IsLeaf(self): 552 def _IsLeaf(self):
546 return self._left is None 553 return self._left is None
547 554
548 @classmethod 555 @classmethod
549 def _Overlaps(cls, event, start, end): 556 def _Overlaps(cls, event, start, end):
550 return (min(end, event.end_msec) - max(start, event.start_msec) > 0 557 return (min(end, event.end_msec) - max(start, event.start_msec) > 0
551 or start <= event.start_msec < end) # For instant events. 558 or start <= event.start_msec < end) # For instant events.
OLDNEW
« tools/android/loading/loading_trace.py ('K') | « tools/android/loading/request_track.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698