Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / test / gpu / page_sets / gpu_process_tests.py
blob2ab2bd8ec239347b5f58a2eb772d3325f315afb3
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from telemetry.story import story_set as story_set_module
6 from gpu_tests import gpu_test_base
8 class GpuProcessTestsPage(gpu_test_base.PageBase):
10 def __init__(self, url, name, story_set, expectations):
11 super(GpuProcessTestsPage, self).__init__(url=url, page_set=story_set,
12 name=name,
13 expectations=expectations)
16 class FunctionalVideoPage(GpuProcessTestsPage):
18 def __init__(self, story_set, expectations):
19 super(FunctionalVideoPage, self).__init__(
20 url='file://../../data/gpu/functional_video.html',
21 name='GpuProcess.video',
22 story_set=story_set,
23 expectations=expectations)
25 def RunNavigateSteps(self, action_runner):
26 super(FunctionalVideoPage, self).RunNavigateSteps(action_runner)
27 action_runner.WaitForJavaScriptCondition(
28 'domAutomationController._finished', timeout_in_seconds=30)
31 class GpuInfoCompletePage(GpuProcessTestsPage):
33 def __init__(self, story_set, expectations):
34 super(GpuInfoCompletePage, self).__init__(
35 url='file://../../data/gpu/functional_3d_css.html',
36 name='GpuProcess.gpu_info_complete',
37 story_set=story_set,
38 expectations=expectations)
40 def Validate(self, tab, results):
41 # Regression test for crbug.com/454906
42 if not tab.browser.supports_system_info:
43 raise page_test.Failure('Browser must support system info')
44 system_info = tab.browser.GetSystemInfo()
45 if not system_info.gpu:
46 raise page_test.Failure('Target machine must have a GPU')
47 if not system_info.gpu.aux_attributes:
48 raise page_test.Failure('Browser must support GPU aux attributes')
49 if not 'gl_renderer' in system_info.gpu.aux_attributes:
50 raise page_test.Failure('Browser must have gl_renderer in aux attribs')
51 if len(system_info.gpu.aux_attributes['gl_renderer']) <= 0:
52 raise page_test.Failure('Must have a non-empty gl_renderer string')
55 class GpuProcessTestsStorySet(story_set_module.StorySet):
57 """ Tests that accelerated content triggers the creation of a GPU process """
59 def __init__(self, expectations):
60 super(GpuProcessTestsStorySet, self).__init__(
61 serving_dirs=set(['../../../../content/test/data']))
63 urls_and_names_list = [
64 ('file://../../data/gpu/functional_canvas_demo.html',
65 'GpuProcess.canvas2d'),
66 ('file://../../data/gpu/functional_3d_css.html',
67 'GpuProcess.css3d'),
68 ('file://../../data/gpu/functional_webgl.html',
69 'GpuProcess.webgl')
72 for url, name in urls_and_names_list:
73 self.AddStory(GpuProcessTestsPage(url, name, self, expectations))
75 self.AddStory(FunctionalVideoPage(self, expectations))
76 self.AddStory(GpuInfoCompletePage(self, expectations))