Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / test / gpu / page_sets / gpu_process_tests.py
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 # pylint: disable=W0401,W0614
5 from telemetry.page.actions.all_page_actions import *
6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module
8
9
10 class GpuProcessTestsPage(page_module.Page):
11
12   def __init__(self, url, name, page_set):
13     super(GpuProcessTestsPage, self).__init__(url=url, page_set=page_set,
14                                               name=name)
15     self.user_agent_type = 'desktop'
16
17   def RunNavigateSteps(self, action_runner):
18     action_runner.RunAction(NavigateAction())
19
20 class FunctionalVideoPage(GpuProcessTestsPage):
21
22   def __init__(self, page_set):
23     super(FunctionalVideoPage, self).__init__(
24       url='file://../../data/gpu/functional_video.html',
25       name='GpuProcess.video',
26       page_set=page_set)
27
28   def RunNavigateSteps(self, action_runner):
29     action_runner.RunAction(NavigateAction())
30     action_runner.RunAction(WaitAction(
31       {
32         'javascript': 'domAutomationController._finished',
33         'timeout': 30
34       }))
35
36
37 class GpuProcessTestsPageSet(page_set_module.PageSet):
38
39   """ Tests that accelerated content triggers the creation of a GPU process """
40
41   def __init__(self):
42     super(GpuProcessTestsPageSet, self).__init__(
43       serving_dirs=set(['../../../../content/test/data']),
44       user_agent_type='desktop')
45
46     urls_and_names_list = [
47       ('file://../../data/gpu/functional_canvas_demo.html',
48        'GpuProcess.canvas2d'),
49       ('file://../../data/gpu/functional_3d_css.html',
50        'GpuProcess.css3d'),
51       ('file://../../data/gpu/functional_webgl.html',
52        'GpuProcess.webgl')
53     ]
54
55     for url, name in urls_and_names_list:
56       self.AddPage(GpuProcessTestsPage(url, name, self))
57
58     self.AddPage(FunctionalVideoPage(self))