| OLD | NEW |
| 1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 from gpu_tests import gpu_test_base | 4 from gpu_tests import gpu_test_base |
| 5 from gpu_tests import trace_test_expectations | 5 from gpu_tests import trace_test_expectations |
| 6 import page_sets | 6 import page_sets |
| 7 | 7 |
| 8 from telemetry.page import page_test | 8 from telemetry.page import page_test |
| 9 from telemetry.timeline import model as model_module | 9 from telemetry.timeline import model as model_module |
| 10 from telemetry.timeline import tracing_config | 10 from telemetry.timeline import tracing_config |
| 11 | 11 |
| 12 TOPLEVEL_GL_CATEGORY = 'gpu_toplevel' | 12 TOPLEVEL_GL_CATEGORY = 'gpu_toplevel' |
| 13 TOPLEVEL_SERVICE_CATEGORY = 'disabled-by-default-gpu.service' | 13 TOPLEVEL_SERVICE_CATEGORY = 'disabled-by-default-gpu.service' |
| 14 TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device' | 14 TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device' |
| 15 TOPLEVEL_CATEGORIES = [TOPLEVEL_SERVICE_CATEGORY, TOPLEVEL_DEVICE_CATEGORY] | 15 TOPLEVEL_CATEGORIES = [TOPLEVEL_SERVICE_CATEGORY, TOPLEVEL_DEVICE_CATEGORY] |
| 16 | 16 |
| 17 test_harness_script = r""" | 17 test_harness_script = r""" |
| 18 var domAutomationController = {}; | 18 var domAutomationController = {}; |
| 19 | 19 |
| 20 domAutomationController._finished = false; | 20 domAutomationController._finished = false; |
| 21 | 21 |
| 22 domAutomationController.setAutomationId = function(id) {} | 22 domAutomationController.setAutomationId = function(id) {} |
| 23 | 23 |
| 24 domAutomationController.send = function(msg) { | 24 domAutomationController.send = function(msg) { |
| 25 // Issue a read pixel to synchronize the gpu process to ensure | 25 // Issue a read pixel to synchronize the gpu process to ensure |
| 26 // the asynchronous category enabling is finished. | 26 // the asynchronous category enabling is finished. |
| 27 var canvas = document.createElement("canvas") | 27 var temp_canvas = document.createElement("canvas") |
| 28 canvas.width = 1; | 28 temp_canvas.width = 1; |
| 29 canvas.height = 1; | 29 temp_canvas.height = 1; |
| 30 var gl = canvas.getContext("webgl"); | 30 var temp_gl = temp_canvas.getContext("experimental-webgl") || |
| 31 gl.clear(gl.COLOR_BUFFER_BIT); | 31 temp_canvas.getContext("webgl"); |
| 32 var id = new Uint8Array(4); | 32 if (temp_gl) { |
| 33 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, id); | 33 temp_gl.clear(temp_gl.COLOR_BUFFER_BIT); |
| 34 var id = new Uint8Array(4); |
| 35 temp_gl.readPixels(0, 0, 1, 1, temp_gl.RGBA, temp_gl.UNSIGNED_BYTE, id); |
| 36 } else { |
| 37 console.log('Failed to get WebGL context.'); |
| 38 } |
| 34 | 39 |
| 35 domAutomationController._finished = true; | 40 domAutomationController._finished = true; |
| 36 } | 41 } |
| 37 | 42 |
| 38 window.domAutomationController = domAutomationController; | 43 window.domAutomationController = domAutomationController; |
| 39 """ | 44 """ |
| 40 | 45 |
| 41 | 46 |
| 42 class TraceValidatorBase(gpu_test_base.ValidatorBase): | 47 class TraceValidatorBase(gpu_test_base.ValidatorBase): |
| 43 def GetCategoryName(self): | 48 def GetCategoryName(self): |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 """Tests GPU Device traces show up on devices that support it.""" | 117 """Tests GPU Device traces show up on devices that support it.""" |
| 113 test = _DeviceTraceValidator | 118 test = _DeviceTraceValidator |
| 114 name = 'DeviceTraceTest' | 119 name = 'DeviceTraceTest' |
| 115 | 120 |
| 116 @classmethod | 121 @classmethod |
| 117 def Name(cls): | 122 def Name(cls): |
| 118 return 'device_trace_test' | 123 return 'device_trace_test' |
| 119 | 124 |
| 120 def _CreateExpectations(self): | 125 def _CreateExpectations(self): |
| 121 return trace_test_expectations.DeviceTraceTestExpectations() | 126 return trace_test_expectations.DeviceTraceTestExpectations() |
| OLD | NEW |