| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 gpu_test_base | 4 from gpu_tests import gpu_test_base |
| 5 import memory_test_expectations | 5 from gpu_tests import memory_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 counter | |
| 10 from telemetry.timeline import model | 9 from telemetry.timeline import model |
| 11 from telemetry.timeline import tracing_category_filter | 10 from telemetry.timeline import tracing_category_filter |
| 12 from telemetry.timeline import tracing_options | 11 from telemetry.timeline import tracing_options |
| 13 | 12 |
| 14 MEMORY_LIMIT_MB = 192 | 13 MEMORY_LIMIT_MB = 192 |
| 15 SINGLE_TAB_LIMIT_MB = 192 | 14 SINGLE_TAB_LIMIT_MB = 192 |
| 16 WIGGLE_ROOM_MB = 24 | 15 WIGGLE_ROOM_MB = 24 |
| 17 | 16 |
| 18 test_harness_script = r""" | 17 test_harness_script = r""" |
| 19 var domAutomationController = {}; | 18 var domAutomationController = {}; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 options.AppendExtraBrowserArgs('--enable-logging') | 82 options.AppendExtraBrowserArgs('--enable-logging') |
| 84 options.AppendExtraBrowserArgs( | 83 options.AppendExtraBrowserArgs( |
| 85 '--force-gpu-mem-available-mb=%s' % MEMORY_LIMIT_MB) | 84 '--force-gpu-mem-available-mb=%s' % MEMORY_LIMIT_MB) |
| 86 | 85 |
| 87 def WillNavigateToPage(self, page, tab): | 86 def WillNavigateToPage(self, page, tab): |
| 88 # FIXME: Remove webkit.console when blink.console lands in chromium and the | 87 # FIXME: Remove webkit.console when blink.console lands in chromium and the |
| 89 # ref builds are updated. crbug.com/386847 | 88 # ref builds are updated. crbug.com/386847 |
| 90 custom_categories = ['webkit.console', 'blink.console', 'gpu'] | 89 custom_categories = ['webkit.console', 'blink.console', 'gpu'] |
| 91 category_filter = tracing_category_filter.TracingCategoryFilter() | 90 category_filter = tracing_category_filter.TracingCategoryFilter() |
| 92 for c in custom_categories: | 91 for c in custom_categories: |
| 93 category_filter.AddIncludedCategory(c) | 92 category_filter.AddIncludedCategory(c) |
| 94 options = tracing_options.TracingOptions() | 93 options = tracing_options.TracingOptions() |
| 95 options.enable_chrome_trace = True | 94 options.enable_chrome_trace = True |
| 96 tab.browser.platform.tracing_controller.Start(options, category_filter, 60) | 95 tab.browser.platform.tracing_controller.Start(options, category_filter, 60) |
| 97 | 96 |
| 98 def _FormatException(self, low_or_high, mb_used): | 97 def _FormatException(self, low_or_high, mb_used): |
| 99 return 'Memory allocation too %s (was %d MB, should be %d MB +/- %d MB)' % ( | 98 return 'Memory allocation too %s (was %d MB, should be %d MB +/- %d MB)' % ( |
| 100 low_or_high, mb_used, SINGLE_TAB_LIMIT_MB, WIGGLE_ROOM_MB) | 99 low_or_high, mb_used, SINGLE_TAB_LIMIT_MB, WIGGLE_ROOM_MB) |
| 101 | 100 |
| 102 class MemoryTest(gpu_test_base.TestBase): | 101 class MemoryTest(gpu_test_base.TestBase): |
| 103 """Tests GPU memory limits""" | 102 """Tests GPU memory limits""" |
| 104 test = MemoryValidator | 103 test = MemoryValidator |
| 105 | 104 |
| 106 @classmethod | 105 @classmethod |
| 107 def Name(cls): | 106 def Name(cls): |
| 108 return 'memory_test' | 107 return 'memory_test' |
| 109 | 108 |
| 110 def _CreateExpectations(self): | 109 def _CreateExpectations(self): |
| 111 return memory_test_expectations.MemoryTestExpectations() | 110 return memory_test_expectations.MemoryTestExpectations() |
| 112 | 111 |
| 113 def CreateStorySet(self, options): | 112 def CreateStorySet(self, options): |
| 114 story_set = page_sets.MemoryTestsStorySet(self.GetExpectations()) | 113 story_set = page_sets.MemoryTestsStorySet(self.GetExpectations()) |
| 115 for page in story_set: | 114 for page in story_set: |
| 116 page.script_to_evaluate_on_commit = test_harness_script | 115 page.script_to_evaluate_on_commit = test_harness_script |
| 117 return story_set | 116 return story_set |
| OLD | NEW |