summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorbajones@chromium.org <bajones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-24 23:38:42 +0000
committerbajones@chromium.org <bajones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-24 23:38:42 +0000
commit7b29c1878bf13b267c0c68d5326d58c1a7540fb8 (patch)
tree96bdff6616bfa15c6123216bfe781ff4f00cf592 /content
parentb40cebaf233cd6347d4623d2545ecd89452909cc (diff)
downloadchromium_src-7b29c1878bf13b267c0c68d5326d58c1a7540fb8.zip
chromium_src-7b29c1878bf13b267c0c68d5326d58c1a7540fb8.tar.gz
chromium_src-7b29c1878bf13b267c0c68d5326d58c1a7540fb8.tar.bz2
Adding memory tests to the telemetry GPU tests
Replaces content_browsertests.GpuMemoryTest BUG=310802 R=dtu@chromium.org, kbr@chromium.org Review URL: https://codereview.chromium.org/37973003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/test/gpu/gpu_tests/memory.py86
-rw-r--r--content/test/gpu/gpu_tests/pixel.py8
-rw-r--r--content/test/gpu/page_sets/memory_tests.json18
3 files changed, 107 insertions, 5 deletions
diff --git a/content/test/gpu/gpu_tests/memory.py b/content/test/gpu/gpu_tests/memory.py
new file mode 100644
index 0000000..c83d7b7
--- /dev/null
+++ b/content/test/gpu/gpu_tests/memory.py
@@ -0,0 +1,86 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from telemetry import test
+from telemetry.page import page_test
+
+MEMORY_LIMIT_MB = 256
+SINGLE_TAB_LIMIT_MB = 128
+WIGGLE_ROOM_MB = 4
+
+test_harness_script = r"""
+ var domAutomationController = {};
+ domAutomationController._finished = false;
+
+ domAutomationController.send = function(msg) {
+ // This should wait until all effects of memory management complete.
+ // We will need to wait until all
+ // 1. pending commits from the main thread to the impl thread in the
+ // compositor complete (for visible compositors).
+ // 2. allocations that the renderer's impl thread will make due to the
+ // compositor and WebGL are completed.
+ // 3. pending GpuMemoryManager::Manage() calls to manage are made.
+ // 4. renderers' OnMemoryAllocationChanged callbacks in response to
+ // manager are made.
+ // Each step in this sequence can cause trigger the next (as a 1-2-3-4-1
+ // cycle), so we will need to pump this cycle until it stabilizes.
+
+ // Pump the cycle 8 times (in principle it could take an infinite number
+ // of iterations to settle).
+
+ var rafCount = 0;
+ var totalRafCount = 8;
+
+ function pumpRAF() {
+ if (rafCount == totalRafCount) {
+ domAutomationController._finished = true;
+ return;
+ }
+ ++rafCount;
+ window.requestAnimationFrame(pumpRAF);
+ }
+ pumpRAF();
+ }
+
+ window.domAutomationController = domAutomationController;
+
+ window.addEventListener("load", function() {
+ useGpuMemory(%d);
+ }, false);
+""" % MEMORY_LIMIT_MB
+
+class MemoryValidator(page_test.PageTest):
+ def __init__(self):
+ super(MemoryValidator, self).__init__('ValidatePage')
+
+ def ValidatePage(self, page, tab, results):
+ mb_used = MemoryValidator.GpuMemoryUsageMbytes(tab)
+
+ if mb_used + WIGGLE_ROOM_MB < SINGLE_TAB_LIMIT_MB:
+ raise page_test.Failure('Memory allocation too low')
+
+ if mb_used - WIGGLE_ROOM_MB > MEMORY_LIMIT_MB:
+ raise page_test.Failure('Memory allocation too high')
+
+ @staticmethod
+ def GpuMemoryUsageMbytes(tab):
+ gpu_rendering_stats_js = 'chrome.gpuBenchmarking.gpuRenderingStats()'
+ gpu_rendering_stats = tab.EvaluateJavaScript(gpu_rendering_stats_js)
+ return gpu_rendering_stats['globalVideoMemoryBytesAllocated'] / 1048576
+
+ def CustomizeBrowserOptions(self, options):
+ options.AppendExtraBrowserArgs('--enable-logging')
+ options.AppendExtraBrowserArgs(
+ '--force-gpu-mem-available-mb=%s' % MEMORY_LIMIT_MB)
+ options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
+
+class Memory(test.Test):
+ """Tests GPU memory limits"""
+ test = MemoryValidator
+ page_set = 'page_sets/memory_tests.json'
+
+ def CreatePageSet(self, options):
+ page_set = super(Memory, self).CreatePageSet(options)
+ for page in page_set.pages:
+ page.script_to_evaluate_on_commit = test_harness_script
+ return page_set \ No newline at end of file
diff --git a/content/test/gpu/gpu_tests/pixel.py b/content/test/gpu/gpu_tests/pixel.py
index ed7d4af..df2e161 100644
--- a/content/test/gpu/gpu_tests/pixel.py
+++ b/content/test/gpu/gpu_tests/pixel.py
@@ -10,7 +10,6 @@ import re
from telemetry import test
from telemetry.core.backends import png_bitmap
from telemetry.page import page_test
-from telemetry.page import test_expectations
test_data_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..', 'data', 'gpu'))
@@ -164,9 +163,8 @@ class Pixel(test.Test):
default="unknownrev")
parser.add_option_group(group)
- def CreateExpectations(self, page_set):
- print page_set.pages
+ def CreatePageSet(self, options):
+ page_set = super(Pixel, self).CreatePageSet(options)
for page in page_set.pages:
page.script_to_evaluate_on_commit = test_harness_script
-
- return test_expectations.TestExpectations()
+ return page_set
diff --git a/content/test/gpu/page_sets/memory_tests.json b/content/test/gpu/page_sets/memory_tests.json
new file mode 100644
index 0000000..9a29aab
--- /dev/null
+++ b/content/test/gpu/page_sets/memory_tests.json
@@ -0,0 +1,18 @@
+{
+ "description": "Tests that validate GPU memory management",
+ "user_agent_type": "desktop",
+ "pages": [
+ {
+ "name": "Memory.CSS3D",
+ "url": "file://../../data/gpu/mem_css3d.html",
+ "navigate_steps": [
+ { "action": "navigate" },
+ {
+ "action": "wait",
+ "javascript": "domAutomationController._finished",
+ "timeout": 60
+ }
+ ]
+ }
+ ]
+}