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 logging 5 6 # pylint: disable=W0401,W0614 7 from telemetry.page.actions.all_page_actions import * 8 from telemetry.page import page as page_module 9 from telemetry.page import page_set as page_set_module 10 11 12 class ToughWebglCasesPage(page_module.Page): 13 14 def __init__(self, url, page_set): 15 super(ToughWebglCasesPage, self).__init__(url=url, page_set=page_set) 16 self.archive_data_file = 'data/tough_webgl_cases.json' 17 18 def CanRunOnBrowser(self, browser_info): 19 if not browser_info.HasWebGLSupport(): 20 logging.warning('Browser does not support webgl, skipping test') 21 return False 22 return True 23 24 def RunNavigateSteps(self, action_runner): 25 action_runner.NavigateToPage(self) 26 action_runner.WaitForJavaScriptCondition( 27 'document.readyState == "complete"') 28 action_runner.Wait(2) 29 30 def RunSmoothness(self, action_runner): 31 action_runner.Wait(5) 32 33 34 class Page1(ToughWebglCasesPage): 35 36 """ 37 Why: Observed performance regression with this demo in M33 38 """ 39 40 def __init__(self, page_set): 41 super(Page1, self).__init__( 42 url='http://montagestudio.com/demos/eco-homes/', 43 page_set=page_set) 44 45 def RunNavigateSteps(self, action_runner): 46 action_runner.NavigateToPage(self) 47 action_runner.WaitForJavaScriptCondition( 48 'document.readyState == "complete"') 49 action_runner.Wait(15) 50 51 52 class Page2(ToughWebglCasesPage): 53 54 def __init__(self, page_set): 55 super(Page2, self).__init__( 56 url='http://helloracer.com/racer-s/', 57 page_set=page_set) 58 59 def RunNavigateSteps(self, action_runner): 60 action_runner.NavigateToPage(self) 61 action_runner.WaitForJavaScriptCondition( 62 'document.readyState == "complete"') 63 action_runner.Wait(10) 64 65 66 class ToughWebglCasesPageSet(page_set_module.PageSet): 67 68 """ 69 Description: Self-driven WebGL animation examples 70 """ 71 72 def __init__(self): 73 super(ToughWebglCasesPageSet, self).__init__( 74 archive_data_file='data/tough_webgl_cases.json') 75 76 self.AddPage(Page1(self)) 77 self.AddPage(Page2(self)) 78 urls_list = [ 79 # pylint: disable=C0301 80 'http://www.khronos.org/registry/webgl/sdk/demos/google/nvidia-vertex-buffer-object/index.html', 81 # pylint: disable=C0301 82 'http://www.khronos.org/registry/webgl/sdk/demos/google/san-angeles/index.html', 83 # pylint: disable=C0301 84 'http://www.khronos.org/registry/webgl/sdk/demos/google/particles/index.html', 85 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/Earth.html', 86 # pylint: disable=C0301 87 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/ManyPlanetsDeep.html', 88 'http://webglsamples.googlecode.com/hg/aquarium/aquarium.html', 89 'http://webglsamples.googlecode.com/hg/blob/blob.html', 90 # pylint: disable=C0301 91 'http://webglsamples.googlecode.com/hg/dynamic-cubemap/dynamic-cubemap.html' 92 ] 93 for url in urls_list: 94 self.AddPage(ToughWebglCasesPage(url, self)) 95