OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 import os | 4 import os |
5 | 5 |
6 from telemetry import test as test_module | 6 from telemetry import test as test_module |
7 from telemetry.core import util | 7 from telemetry.core import util |
8 from telemetry.page import page_set | 8 from telemetry.page import page_set |
9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 raise page_test.Failure('Browser must support tab control') | 65 raise page_test.Failure('Browser must support tab control') |
66 # Reset the test's state. | 66 # Reset the test's state. |
67 tab.EvaluateJavaScript( | 67 tab.EvaluateJavaScript( |
68 'window.domAutomationController._succeeded = false'); | 68 'window.domAutomationController._succeeded = false'); |
69 tab.EvaluateJavaScript( | 69 tab.EvaluateJavaScript( |
70 'window.domAutomationController._finished = false'); | 70 'window.domAutomationController._finished = false'); |
71 # Crash the GPU process. | 71 # Crash the GPU process. |
72 new_tab = tab.browser.tabs.New() | 72 new_tab = tab.browser.tabs.New() |
73 # To access these debug URLs from Telemetry, they have to be | 73 # To access these debug URLs from Telemetry, they have to be |
74 # written using the chrome:// scheme. | 74 # written using the chrome:// scheme. |
75 new_tab.Navigate('chrome://gpucrash') | 75 # The try/except is a workaround for crbug.com/368107. |
| 76 try: |
| 77 new_tab.Navigate('chrome://gpucrash') |
| 78 except (exceptions.TabCrashException, Exception): |
| 79 print 'Tab crashed while navigating to chrome://gpucrash' |
76 # Activate the original tab and wait for completion. | 80 # Activate the original tab and wait for completion. |
77 tab.Activate() | 81 tab.Activate() |
78 completed = False | 82 completed = False |
79 try: | 83 try: |
80 util.WaitFor(lambda: tab.EvaluateJavaScript( | 84 util.WaitFor(lambda: tab.EvaluateJavaScript( |
81 'window.domAutomationController._finished'), wait_timeout) | 85 'window.domAutomationController._finished'), wait_timeout) |
82 completed = True | 86 completed = True |
83 except util.TimeoutException: | 87 except util.TimeoutException: |
84 pass | 88 pass |
85 new_tab.Close() | 89 # The try/except is a workaround for crbug.com/368107. |
| 90 try: |
| 91 new_tab.Close() |
| 92 except (exceptions.TabCrashException, Exception): |
| 93 print 'Tab crashed while closing chrome://gpucrash' |
86 if not completed: | 94 if not completed: |
87 raise page_test.Failure( | 95 raise page_test.Failure( |
88 'Test didn\'t complete (no context lost event?)') | 96 'Test didn\'t complete (no context lost event?)') |
89 if not tab.EvaluateJavaScript( | 97 if not tab.EvaluateJavaScript( |
90 'window.domAutomationController._succeeded'): | 98 'window.domAutomationController._succeeded'): |
91 raise page_test.Failure( | 99 raise page_test.Failure( |
92 'Test failed (context not restored properly?)') | 100 'Test failed (context not restored properly?)') |
93 | 101 |
94 class ContextLost(test_module.Test): | 102 class ContextLost(test_module.Test): |
95 enabled = True | 103 enabled = True |
(...skipping 26 matching lines...) Expand all Loading... |
122 'navigate_steps': [ | 130 'navigate_steps': [ |
123 { 'action': 'navigate' }, | 131 { 'action': 'navigate' }, |
124 { 'action': 'wait', | 132 { 'action': 'wait', |
125 'javascript': 'window.domAutomationController._finished' } | 133 'javascript': 'window.domAutomationController._finished' } |
126 ], | 134 ], |
127 'kill_gpu_process': False | 135 'kill_gpu_process': False |
128 }, | 136 }, |
129 ] | 137 ] |
130 } | 138 } |
131 return page_set.PageSet.FromDict(page_set_dict, data_path) | 139 return page_set.PageSet.FromDict(page_set_dict, data_path) |
OLD | NEW |