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

Unified Diff: content/test/gpu/gpu_tests/trace_integration_test.py

Issue 2604153005: Port trace_test to the new gpu_integration_test harness. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/gpu/generate_buildbot_json.py ('k') | content/test/gpu/gpu_tests/trace_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/trace_integration_test.py
diff --git a/content/test/gpu/gpu_tests/trace_test.py b/content/test/gpu/gpu_tests/trace_integration_test.py
similarity index 53%
rename from content/test/gpu/gpu_tests/trace_test.py
rename to content/test/gpu/gpu_tests/trace_integration_test.py
index 996cccac245dcf8c4457fdbae4ab9a6f86adbc84..98ae4033ddc524ce1ddc8d95f5f6d8396596470a 100644
--- a/content/test/gpu/gpu_tests/trace_test.py
+++ b/content/test/gpu/gpu_tests/trace_integration_test.py
@@ -1,11 +1,14 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
+# Copyright 2016 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_tests import gpu_test_base
+
+import os
+
+from gpu_tests import gpu_integration_test
+from gpu_tests import path_util
+from gpu_tests import pixel_test_pages
from gpu_tests import trace_test_expectations
-import page_sets
-from telemetry.page import legacy_page_test
from telemetry.timeline import model as model_module
from telemetry.timeline import tracing_config
@@ -14,6 +17,9 @@ TOPLEVEL_SERVICE_CATEGORY = 'disabled-by-default-gpu.service'
TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device'
TOPLEVEL_CATEGORIES = [TOPLEVEL_SERVICE_CATEGORY, TOPLEVEL_DEVICE_CATEGORY]
+data_path = os.path.join(
+ path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu')
+
test_harness_script = r"""
var domAutomationController = {};
@@ -43,84 +49,80 @@ test_harness_script = r"""
window.domAutomationController = domAutomationController;
"""
+class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
+ """Tests GPU traces are plumbed through properly.
-class TraceValidatorBase(gpu_test_base.ValidatorBase):
- def GetCategoryName(self):
- raise NotImplementedError("GetCategoryName() Not implemented!")
-
- def ValidateAndMeasurePage(self, page, tab, results):
- timeline_data = tab.browser.platform.tracing_controller.StopTracing()
- timeline_model = model_module.TimelineModel(timeline_data)
+ Also tests that GPU Device traces show up on devices that support them."""
- category_name = self.GetCategoryName()
- event_iter = timeline_model.IterAllEvents(
- event_type_predicate=model_module.IsSliceOrAsyncSlice)
- for event in event_iter:
- if (event.args.get('gl_category', None) == TOPLEVEL_GL_CATEGORY and
- event.category == category_name):
- break
- else:
- raise legacy_page_test.Failure(self._FormatException(category_name))
+ @classmethod
+ def Name(cls):
+ return 'trace_test'
- def CustomizeBrowserOptions(self, options):
+ @classmethod
+ def CustomizeOptions(cls):
+ options = cls._finder_options.browser_options
options.AppendExtraBrowserArgs('--enable-logging')
options.AppendExtraBrowserArgs('--enable-experimental-canvas-features')
- def WillNavigateToPage(self, page, tab):
+ @classmethod
+ def GenerateGpuTests(cls, options):
+ # Include the device level trace tests, even though they're
+ # currently skipped on all platforms, to give a hint that they
+ # should perhaps be enabled in the future.
+ for p in pixel_test_pages.DefaultPages('TraceTest'):
+ yield (p.name, p.url, (TOPLEVEL_SERVICE_CATEGORY))
+ for p in pixel_test_pages.DefaultPages('DeviceTraceTest'):
+ yield (p.name, p.url, (TOPLEVEL_DEVICE_CATEGORY))
+
+ def RunActualGpuTest(self, test_path, *args):
+ # The version of this test in the old GPU test harness restarted
+ # the browser after each test, so continue to do that to match its
+ # behavior.
+ self._RestartBrowser('Restarting browser to ensure clean traces')
+
+ # Set up tracing.
config = tracing_config.TracingConfig()
config.chrome_trace_config.category_filter.AddExcludedCategory('*')
for cat in TOPLEVEL_CATEGORIES:
- config.chrome_trace_config.category_filter.AddDisabledByDefault(
- cat)
+ config.chrome_trace_config.category_filter.AddDisabledByDefault(cat)
config.enable_chrome_trace = True
+ tab = self.tab
tab.browser.platform.tracing_controller.StartTracing(config, 60)
- def _FormatException(self, category):
- return 'Trace markers for GPU category was not found: %s' % category
-
-
-class _TraceValidator(TraceValidatorBase):
- def GetCategoryName(self):
- return TOPLEVEL_SERVICE_CATEGORY
+ # Perform page navigation.
+ url = self.UrlOfStaticFilePath(test_path)
+ tab.Navigate(url, script_to_evaluate_on_commit=test_harness_script)
+ tab.action_runner.WaitForJavaScriptCondition(
+ 'domAutomationController._finished', timeout_in_seconds=30)
+ # Stop tracing.
+ timeline_data = tab.browser.platform.tracing_controller.StopTracing()
-class _DeviceTraceValidator(TraceValidatorBase):
- def GetCategoryName(self):
- return TOPLEVEL_DEVICE_CATEGORY
-
-
-class TraceTestBase(gpu_test_base.TestBase):
- """Base class for the trace tests."""
- def CreateStorySet(self, options):
- # Utilize pixel tests page set as a set of simple pages to load.
- story_set = page_sets.PixelTestsStorySet(self.GetExpectations(),
- base_name=self.Name())
- for story in story_set:
- story.script_to_evaluate_on_commit = test_harness_script
- return story_set
-
+ # Evaluate success.
+ timeline_model = model_module.TimelineModel(timeline_data)
+ category_name = args[0]
+ event_iter = timeline_model.IterAllEvents(
+ event_type_predicate=model_module.IsSliceOrAsyncSlice)
+ for event in event_iter:
+ if (event.args.get('gl_category', None) == TOPLEVEL_GL_CATEGORY and
+ event.category == category_name):
+ print 'Found event with category name ' + category_name
+ break
+ else:
+ self.fail(self._FormatException(category_name))
-class TraceTest(TraceTestBase):
- """Tests GPU traces are plumbed through properly."""
- test = _TraceValidator
- name = 'TraceTest'
+ def _FormatException(self, category):
+ return 'Trace markers for GPU category were not found: %s' % category
@classmethod
- def Name(cls):
- return 'trace_test'
-
- def _CreateExpectations(self):
+ def _CreateExpectations(cls):
return trace_test_expectations.TraceTestExpectations()
-
-class DeviceTraceTest(TraceTestBase):
- """Tests GPU Device traces show up on devices that support it."""
- test = _DeviceTraceValidator
- name = 'DeviceTraceTest'
-
@classmethod
- def Name(cls):
- return 'device_trace_test'
-
- def _CreateExpectations(self):
- return trace_test_expectations.DeviceTraceTestExpectations()
+ def setUpClass(cls):
+ super(cls, TraceIntegrationTest).setUpClass()
+ path_util.SetupTelemetryPaths()
+ cls.CustomizeOptions()
+ cls.SetBrowserOptions(cls._finder_options)
+ cls.StartBrowser()
+ cls.SetStaticServerDirs([data_path])
« no previous file with comments | « content/test/gpu/generate_buildbot_json.py ('k') | content/test/gpu/gpu_tests/trace_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698