Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / test / gpu / gpu_tests / screenshot_sync.py
blobc7f5b3ecda39fc722418c016bfeee45e747f9a81
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 import os
6 import screenshot_sync_expectations as expectations
8 from telemetry import benchmark
9 from telemetry.core import util
10 from telemetry.page import page
11 from telemetry.page import page_set
12 from telemetry.page import page_test
14 data_path = os.path.join(
15 util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu')
17 @benchmark.Disabled('mac')
18 class _ScreenshotSyncValidator(page_test.PageTest):
19 def CustomizeBrowserOptions(self, options):
20 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
22 def ValidateAndMeasurePage(self, page, tab, results):
23 test_success = tab.EvaluateJavaScript('window.__testSuccess')
24 if not test_success:
25 message = tab.EvaluateJavaScript('window.__testMessage')
26 raise page_test.Failure(message)
29 @benchmark.Disabled('mac')
30 class ScreenshotSyncPage(page.Page):
31 def __init__(self, page_set, base_dir):
32 super(ScreenshotSyncPage, self).__init__(
33 url='file://screenshot_sync.html',
34 page_set=page_set,
35 base_dir=base_dir,
36 name='ScreenshotSync')
37 self.user_agent_type = 'desktop'
39 def RunNavigateSteps(self, action_runner):
40 action_runner.NavigateToPage(self)
41 action_runner.WaitForJavaScriptCondition(
42 'window.__testComplete', timeout_in_seconds=120)
45 @benchmark.Disabled('mac')
46 class ScreenshotSyncProcess(benchmark.Benchmark):
47 """Tests that screenhots are properly synchronized with the frame one which
48 they were requested"""
49 test = _ScreenshotSyncValidator
51 def CreateExpectations(self, page_set):
52 return expectations.ScreenshotSyncExpectations()
54 def CreatePageSet(self, options):
55 ps = page_set.PageSet(file_path=data_path, serving_dirs=[''])
56 ps.AddPage(ScreenshotSyncPage(ps, ps.base_dir))
57 return ps