Commit c8ad009e authored by horo's avatar horo Committed by Commit bot

Check the context type in StopChromeTracing

DevToolsClientBackend.StopChromeTracing() tries to call console.time & console.timeEnd.
But in ServiceWorker telemetry tests, ServiceWorker may have already stopped by itself.
This is causing the test flakiness.

So this cl add checking if the context type is 'iframe', 'page'  or 'webview'.

BUG=433943
TEST=./tools/perf/run_benchmark --browser-executable=~/chromium/src/out/Debug/chrome --also-run-disabled-tests service_worker.service_worker

Review URL: https://codereview.chromium.org/884573004

Cr-Commit-Position: refs/heads/master@{#317730}
parent 5f189825
......@@ -134,6 +134,8 @@ class DevToolsClientBackend(object):
def StopChromeTracing(self, trace_data_builder, timeout=30):
context_map = self.GetUpdatedInspectableContexts()
for context in context_map.contexts:
if context['type'] not in ['iframe', 'page', 'webview']:
continue
context_id = context['id']
backend = context_map.GetInspectorBackend(context_id)
success = backend.EvaluateJavaScript(
......
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import decorators
from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options
from telemetry.unittest_util import tab_test_case
class TracingControllerTest(tab_test_case.TabTestCase):
# Disabled due to http://crbug.com/459807
@decorators.Disabled
@decorators.Isolated
def testModifiedConsoleTime(self):
category_filter = tracing_category_filter.TracingCategoryFilter()
options = tracing_options.TracingOptions()
options.enable_chrome_trace = True
self._tab.browser.platform.tracing_controller.Start(options,
category_filter)
self.Navigate('blank.html')
self.assertEquals(
self._tab.EvaluateJavaScript('document.location.pathname;'),
'/blank.html')
self._tab.EvaluateJavaScript('console.time = function() { };')
with self.assertRaisesRegexp(Exception, 'Page stomped on console.time'):
self._tab.browser.platform.tracing_controller.Stop()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment