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

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

Issue 874023003: Separate GPU Trace Test into 2 tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Standardize base class naming Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/trace_test_expectations.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_test.py
diff --git a/content/test/gpu/gpu_tests/trace_test.py b/content/test/gpu/gpu_tests/trace_test.py
index fb4de0fbffd28d7044d6355252dc056d0a09f82c..df9e5b7a147d8ccdbf111c4b99e85a618267b069 100644
--- a/content/test/gpu/gpu_tests/trace_test.py
+++ b/content/test/gpu/gpu_tests/trace_test.py
@@ -8,11 +8,12 @@ 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
+from telemetry.timeline import model as model_module
TOPLEVEL_GL_CATEGORY = 'gpu_toplevel'
-TOPLEVEL_CATEGORIES = ['disabled-by-default-gpu.device',
- 'disabled-by-default-gpu.service']
+TOPLEVEL_SERVICE_CATEGORY = 'disabled-by-default-gpu.service'
+TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device'
+TOPLEVEL_CATEGORIES = [TOPLEVEL_SERVICE_CATEGORY, TOPLEVEL_DEVICE_CATEGORY]
test_harness_script = r"""
var domAutomationController = {};
@@ -28,19 +29,24 @@ test_harness_script = r"""
window.domAutomationController = domAutomationController;
"""
-class _TraceValidator(page_test.PageTest):
+
+class _TraceValidatorBase(page_test.PageTest):
+ def GetCategoryName(self):
+ raise NotImplementedError("GetCategoryName() Not implemented!")
+
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:
+ timeline_model = model_module.TimelineModel(timeline_data)
+
+ 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 page_test.Failure(self._FormatException(sorted(categories_set)))
+ raise page_test.Failure(self._FormatException(category_name))
def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs('--enable-logging')
@@ -52,23 +58,49 @@ class _TraceValidator(page_test.PageTest):
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
+ def _FormatException(self, category):
+ return 'Trace markers for GPU category was not found: %s' % category
-class TraceTest(benchmark.Benchmark):
- """Tests GPU traces"""
- test = _TraceValidator
- @classmethod
- def Name(cls):
- return 'trace_test'
+class _TraceValidator(_TraceValidatorBase):
vmiura 2015/02/02 23:42:15 nit: "Service"TraceValidator, and similar in the o
David Yen 2015/02/02 23:52:46 I actually had this name originally, but I think a
+ def GetCategoryName(self):
+ return TOPLEVEL_SERVICE_CATEGORY
+
+
+class _DeviceTraceValidator(_TraceValidatorBase):
+ def GetCategoryName(self):
+ return TOPLEVEL_DEVICE_CATEGORY
- def CreateExpectations(self):
- return trace_test_expectations.TraceTestExpectations()
+class _TraceTestBase(benchmark.Benchmark):
+ """Base class for the trace tests."""
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
+
+
+class TraceTest(_TraceTestBase):
+ """Tests GPU traces are plumbed through properly."""
+ test = _TraceValidator
+
+ @classmethod
+ def Name(cls):
+ return 'trace_test'
+
+ def CreateExpectations(self):
+ return trace_test_expectations.TraceTestExpectations()
+
+
+class DeviceTraceTest(_TraceTestBase):
+ """Tests GPU Device traces show up on devices that support it."""
+ test = _DeviceTraceValidator
+
+ @classmethod
+ def Name(cls):
+ return 'device_trace_test'
+
+ def CreateExpectations(self):
+ return trace_test_expectations.DeviceTraceTestExpectations()
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/trace_test_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698