diff options
author | dyen <dyen@chromium.org> | 2015-01-09 11:28:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-09 19:29:20 +0000 |
commit | 59c6163375409ec074ae16896ed555e9f2a999d2 (patch) | |
tree | a080c56b932b0c595dc6c09d1df8db096b0550ab /content/test | |
parent | 4a43a9c3dc7094e2673f6c5e9ed2c200db53543e (diff) | |
download | chromium_src-59c6163375409ec074ae16896ed555e9f2a999d2.zip chromium_src-59c6163375409ec074ae16896ed555e9f2a999d2.tar.gz chromium_src-59c6163375409ec074ae16896ed555e9f2a999d2.tar.bz2 |
Added test to ensure gpu_toplevel marker is plumbed through blink.
This is a simple test which makes sure that the gpu_toplevel marker
works for all gpu categories (gpu.service, gpu.device).
R=vmiura@chromium.org,zmo@chromium.org
BUG=NONE
TEST=trybots
Review URL: https://codereview.chromium.org/806733009
Cr-Commit-Position: refs/heads/master@{#310812}
Diffstat (limited to 'content/test')
-rw-r--r-- | content/test/gpu/gpu_tests/trace_test.py | 70 | ||||
-rw-r--r-- | content/test/gpu/gpu_tests/trace_test_expectations.py | 15 |
2 files changed, 85 insertions, 0 deletions
diff --git a/content/test/gpu/gpu_tests/trace_test.py b/content/test/gpu/gpu_tests/trace_test.py new file mode 100644 index 0000000..128448d --- /dev/null +++ b/content/test/gpu/gpu_tests/trace_test.py @@ -0,0 +1,70 @@ +# Copyright (c) 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. +import trace_test_expectations +import page_sets + +from telemetry import benchmark +from telemetry.page import page_test +from telemetry.core.platform import tracing_category_filter +from telemetry.core.platform import tracing_options +from telemetry.timeline import model + +TOPLEVEL_GL_CATEGORY = 'gpu_toplevel' +TOPLEVEL_CATEGORIES = ['disabled-by-default-gpu.device', + 'disabled-by-default-gpu.service'] + +test_harness_script = r""" + var domAutomationController = {}; + + domAutomationController._finished = false; + + domAutomationController.setAutomationId = function(id) {} + + domAutomationController.send = function(msg) { + domAutomationController._finished = true; + } + + window.domAutomationController = domAutomationController; +""" + +class _TraceValidator(page_test.PageTest): + def ValidateAndMeasurePage(self, page, tab, results): + timeline_data = tab.browser.platform.tracing_controller.Stop() + timeline_model = model.TimelineModel(timeline_data) + + categories_set = set(TOPLEVEL_CATEGORIES) + for event in timeline_model.IterAllEvents(): + if event.args.get('gl_category', None) == TOPLEVEL_GL_CATEGORY: + categories_set.discard(event.category) + if not categories_set: + break + else: + raise page_test.Failure(self._FormatException(sorted(categories_set))) + + def CustomizeBrowserOptions(self, options): + options.AppendExtraBrowserArgs('--enable-logging') + + def WillNavigateToPage(self, page, tab): + cat_string = ','.join(TOPLEVEL_CATEGORIES) + cat_filter = tracing_category_filter.TracingCategoryFilter(cat_string) + options = tracing_options.TracingOptions() + options.enable_chrome_trace = True + tab.browser.platform.tracing_controller.Start(options, cat_filter, 60) + + def _FormatException(self, categories): + return 'Trace markers for GPU categories were not found: %s' % categories + +class TraceTest(benchmark.Benchmark): + """Tests GPU traces""" + test = _TraceValidator + + def CreateExpectations(self): + return trace_test_expectations.TraceTestExpectations() + + def CreatePageSet(self, options): + # Utilize pixel tests page set as a set of simple pages to load. + page_set = page_sets.PixelTestsPageSet() + for page in page_set.pages: + page.script_to_evaluate_on_commit = test_harness_script + return page_set diff --git a/content/test/gpu/gpu_tests/trace_test_expectations.py b/content/test/gpu/gpu_tests/trace_test_expectations.py new file mode 100644 index 0000000..ed9a402 --- /dev/null +++ b/content/test/gpu/gpu_tests/trace_test_expectations.py @@ -0,0 +1,15 @@ +# 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 gpu_test_expectations import GpuTestExpectations + +# See the GpuTestExpectations class for documentation. + +class TraceTestExpectations(GpuTestExpectations): + def SetExpectations(self): + # Sample Usage: + # self.Fail('Pixel.Canvas2DRedBox', + # ['mac', 'amd', ('nvidia', 0x1234)], bug=123) + + pass |