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

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 14977013: Delete Automation[Tab/Renderer]Helper and users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update now that 202087 is committed Created 7 years, 7 months 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
« no previous file with comments | « chrome/test/functional/perf_endure.py ('k') | chrome/test/webdriver/webdriver_automation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index c06517e5ff721d844c5e17d4bd7966bfb56845d8..9dba93cf9b0a0e33cd8ec4bac4864e77fa52b8cb 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -3628,7 +3628,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
return self.ExecuteJavascript(js, tab_index, windex)
def HeapProfilerDump(self, process_type, reason, tab_index=0, windex=0):
- """Dumps a heap profile. It works only on Linux and ChromeOS.
+ """Dumps a heap profile. It works only on Linux and ChromeOS.
We need an environment variable "HEAPPROFILE" set to a directory and a
filename prefix, for example, "/tmp/prof". In a case of this example,
@@ -3636,6 +3636,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
"/tmp/prof.(pid).0003.heap", and so on. Nothing happens when this
function is called without the env.
+ Also, this requires the --enable-memory-benchmarking command line flag.
+
Args:
process_type: A string which is one of 'browser' or 'renderer'.
reason: A string which describes the reason for dumping a heap profile.
@@ -3653,14 +3655,18 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
"""
assert process_type in ('browser', 'renderer')
if self.IsLinux(): # IsLinux() also implies IsChromeOS().
- cmd_dict = {
- 'command': 'HeapProfilerDump',
- 'process_type': process_type,
- 'reason': reason,
- 'windex': windex,
- 'tab_index': tab_index,
- }
- self._GetResultFromJSONRequest(cmd_dict)
+ js = """
+ if (!chrome.memoryBenchmarking ||
+ !chrome.memoryBenchmarking.isHeapProfilerRunning()) {
+ domAutomationController.send('memory benchmarking disabled');
+ } else {
+ chrome.memoryBenchmarking.heapProfilerDump("%s", "%s");
+ domAutomationController.send('success');
+ }
+ """ % (process_type, reason.replace('"', '\\"'))
+ result = self.ExecuteJavascript(js, tab_index, windex)
+ if result != 'success':
+ raise JSONInterfaceError('Heap profiler dump failed: ' + result)
else:
logging.warn('Heap-profiling is not supported in this OS.')
« no previous file with comments | « chrome/test/functional/perf_endure.py ('k') | chrome/test/webdriver/webdriver_automation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698