summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-14 19:46:56 +0000
committernednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-14 19:46:56 +0000
commitb3e9723b2c69751bf799fd6f996d0806cbbf87a3 (patch)
tree783306f3cef3f126e6fa431a16909e72a06c4442
parente733fff4386a5b42d6e76ae63cd4151ad4f6b41c (diff)
downloadchromium_src-b3e9723b2c69751bf799fd6f996d0806cbbf87a3.zip
chromium_src-b3e9723b2c69751bf799fd6f996d0806cbbf87a3.tar.gz
chromium_src-b3e9723b2c69751bf799fd6f996d0806cbbf87a3.tar.bz2
Convert page_set's file path references to python class references for gpu_tests.
BUG=362293 Review URL: https://codereview.chromium.org/335913003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277253 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/test/gpu/gpu_tests/gpu_process.py3
-rw-r--r--content/test/gpu/gpu_tests/gpu_rasterization.py6
-rw-r--r--content/test/gpu/gpu_tests/memory.py3
-rw-r--r--content/test/gpu/gpu_tests/pixel.py3
-rw-r--r--content/test/gpu/page_sets/__init__.py22
5 files changed, 22 insertions, 15 deletions
diff --git a/content/test/gpu/gpu_tests/gpu_process.py b/content/test/gpu/gpu_tests/gpu_process.py
index 33114dc..cb07c55 100644
--- a/content/test/gpu/gpu_tests/gpu_process.py
+++ b/content/test/gpu/gpu_tests/gpu_process.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gpu_process_expectations as expectations
+import page_sets
from telemetry import test
from telemetry.page import page_set
@@ -35,7 +36,7 @@ class _GpuProcessValidator(page_test.PageTest):
class GpuProcess(test.Test):
"""Tests that accelerated content triggers the creation of a GPU process"""
test = _GpuProcessValidator
- page_set = 'page_sets/gpu_process_tests.py'
+ page_set = page_sets.GpuProcessTestsPageSet
def CreateExpectations(self, page_set):
return expectations.GpuProcessExpectations()
diff --git a/content/test/gpu/gpu_tests/gpu_rasterization.py b/content/test/gpu/gpu_tests/gpu_rasterization.py
index 90e9c2c..a4b427e 100644
--- a/content/test/gpu/gpu_tests/gpu_rasterization.py
+++ b/content/test/gpu/gpu_tests/gpu_rasterization.py
@@ -2,8 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import optparse
import cloud_storage_test_base
+import optparse
+import page_sets
+
test_harness_script = r"""
var domAutomationController = {};
@@ -64,7 +66,7 @@ class _GpuRasterizationValidator(cloud_storage_test_base.ValidatorBase):
class GpuRasterization(cloud_storage_test_base.TestBase):
"""Tests that GPU rasterization produces valid content"""
test = _GpuRasterizationValidator
- page_set = 'page_sets/gpu_rasterization_tests.py'
+ page_set = page_sets.GpuRasterizationTestsPageSet
def CreatePageSet(self, options):
page_set = super(GpuRasterization, self).CreatePageSet(options)
diff --git a/content/test/gpu/gpu_tests/memory.py b/content/test/gpu/gpu_tests/memory.py
index 2e94d82..f85b8fc 100644
--- a/content/test/gpu/gpu_tests/memory.py
+++ b/content/test/gpu/gpu_tests/memory.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import memory_expectations
+import page_sets
from telemetry import test
from telemetry.page import page_test
@@ -92,7 +93,7 @@ class _MemoryValidator(page_test.PageTest):
class Memory(test.Test):
"""Tests GPU memory limits"""
test = _MemoryValidator
- page_set = 'page_sets/memory_tests.py'
+ page_set = page_sets.MemoryTestsPageSet
def CreateExpectations(self, page_set):
return memory_expectations.MemoryExpectations()
diff --git a/content/test/gpu/gpu_tests/pixel.py b/content/test/gpu/gpu_tests/pixel.py
index b9de793..b772203a 100644
--- a/content/test/gpu/gpu_tests/pixel.py
+++ b/content/test/gpu/gpu_tests/pixel.py
@@ -8,6 +8,7 @@ import os
import re
import cloud_storage_test_base
+import page_sets
import pixel_expectations
from telemetry import test
@@ -146,7 +147,7 @@ class _PixelValidator(cloud_storage_test_base.ValidatorBase):
class Pixel(cloud_storage_test_base.TestBase):
test = _PixelValidator
- page_set = 'page_sets/pixel_tests.py'
+ page_set = page_sets.PixelTestsPageSet
@classmethod
def AddTestCommandLineArgs(cls, group):
diff --git a/content/test/gpu/page_sets/__init__.py b/content/test/gpu/page_sets/__init__.py
index ed3e1cc..5843513 100644
--- a/content/test/gpu/page_sets/__init__.py
+++ b/content/test/gpu/page_sets/__init__.py
@@ -2,14 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
+import sys
-def GetAllPageSetFilenames():
- results = []
- start_dir = os.path.dirname(__file__)
- for dirpath, _, filenames in os.walk(start_dir):
- for f in filenames:
- if os.path.splitext(f)[1] != '.json':
- continue
- filename = os.path.join(dirpath, f)
- results.append(filename)
- return results
+from telemetry.core import discover
+from telemetry.page import page_set
+
+
+# Import all submodules' PageSet classes.
+start_dir = os.path.dirname(os.path.abspath(__file__))
+top_level_dir = os.path.dirname(start_dir)
+base_class = page_set.PageSet
+for cls in discover.DiscoverClasses(
+ start_dir, top_level_dir, base_class).values():
+ setattr(sys.modules[__name__], cls.__name__, cls)