Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: tools/telemetry/telemetry/multi_page_benchmark.py

Issue 11273081: Adding a test for measuring memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/multi_page_benchmark.py
diff --git a/tools/telemetry/telemetry/multi_page_benchmark.py b/tools/telemetry/telemetry/multi_page_benchmark.py
index a17a031d815738470cb9087070707f2f273505ac..d8c340ea176d3fcd7679f7634f93b4c4bb168f8e 100644
--- a/tools/telemetry/telemetry/multi_page_benchmark.py
+++ b/tools/telemetry/telemetry/multi_page_benchmark.py
@@ -5,6 +5,7 @@ from collections import defaultdict
import os
import sys
+from telemetry import page_interaction
from telemetry import page_test
# Get build/android/pylib scripts into our path.
@@ -149,7 +150,22 @@ class MultiPageBenchmark(page_test.PageTest):
def __init__(self):
super(MultiPageBenchmark, self).__init__('_RunTest')
+ def CustomizeBrowserOptionsForPageSet(self, pages, options):
nduca 2012/11/12 20:58:12 I think you should move this all the way up to pag
marja 2012/11/13 09:47:40 Ok. And I also need to create PageRunner earlier (
+ for page in pages:
+ if not self.CanRunForPage(page):
+ continue
+ interaction = self._GetInteraction(page)
+ if interaction:
+ interaction.CustomizeBrowserOptions(options)
+
def _RunTest(self, page, tab, results):
+ interaction = self._GetInteraction(page)
+ if interaction:
+ tab.WaitForDocumentReadyStateToBeComplete()
+ self.WillRunInteraction(page, tab)
+ interaction.PerformInteraction(page, tab)
+ self.DidRunInteraction(page, tab)
+
results.WillMeasurePage(page)
self.MeasurePage(page, tab, results)
results.DidMeasurePage()
@@ -176,3 +192,26 @@ class MultiPageBenchmark(page_test.PageTest):
results.Add('two_plus_two', 'count', res)
"""
raise NotImplementedError()
+
+ def GetInteractionName(self):
+ """Override to return the name of the interaction to be run.
+
+ Return None if no interaction should be run.
+ """
+ return None
+
+ def _GetInteraction(self, page):
+ interaction_name = self.GetInteractionName()
+ if not interaction_name:
+ return None
+ interaction_data = getattr(page, interaction_name)
+ return page_interaction.FindClassWithName(
+ interaction_data['action'])(interaction_data)
+
+ def WillRunInteraction(self, page, tab): #pylint: disable=W0613
+ """Override to do operations before running the interaction on the page."""
+ pass
+
+ def DidRunInteraction(self, page, tab): #pylint: disable=W0613
+ """Override to do operations after running the interaction on the page."""
+ pass

Powered by Google App Engine
This is Rietveld 408576698