def ValidateAndMeasurePage(self, page, tab, results): timeline_data = tab.browser.platform.tracing_controller.StopTracing() timeline_model = TimelineModel(timeline_data) threads = timeline_model.GetAllThreads() for thread in threads: if thread.name == _CR_RENDERER_MAIN: _AddTracingResults(thread, results)
class _OilpanGCTimesBase(page_test.PageTest): def __init__(self, action_name=''): super(_OilpanGCTimesBase, self).__init__(action_name) self._timeline_model = None def WillNavigateToPage(self, page, tab): # FIXME: Remove webkit.console when blink.console lands in chromium and # the ref builds are updated. crbug.com/386847 categories = ['webkit.console', 'blink.console', 'blink_gc'] category_filter = tracing_category_filter.TracingCategoryFilter() for c in categories: category_filter.AddIncludedCategory(c) options = tracing_options.TracingOptions() options.enable_chrome_trace = True tab.browser.platform.tracing_controller.Start(options, category_filter, timeout=1000) def DidRunActions(self, page, tab): timeline_data = tab.browser.platform.tracing_controller.Stop() self._timeline_model = TimelineModel(timeline_data) def ValidateAndMeasurePage(self, page, tab, results): threads = self._timeline_model.GetAllThreads() for thread in threads: if thread.name == _CR_RENDERER_MAIN: _AddTracingResults(thread.all_slices, results) def CleanUpAfterPage(self, page, tab): if tab.browser.platform.tracing_controller.is_tracing_running: tab.browser.platform.tracing_controller.Stop()