Chromium Code Reviews| Index: chrome/test/functional/devtools_test_base.py |
| diff --git a/chrome/test/functional/devtools_native_memory_snapshot.py b/chrome/test/functional/devtools_test_base.py |
| similarity index 63% |
| copy from chrome/test/functional/devtools_native_memory_snapshot.py |
| copy to chrome/test/functional/devtools_test_base.py |
| index d0d4ad75a6d2d5a11524a3dcaf9bb6fad78789e9..a571a341b414ea4dd935c35d3716a530a99b09a8 100755 |
| --- a/chrome/test/functional/devtools_native_memory_snapshot.py |
| +++ b/chrome/test/functional/devtools_test_base.py |
| @@ -5,6 +5,7 @@ |
| import logging |
| import os |
| +import tempfile |
| from urlparse import urlparse |
| import pyauto_functional # Must be imported before pyauto |
| @@ -14,14 +15,11 @@ import remote_inspector_client |
| import webpagereplay |
| -class DevToolsNativeMemorySnapshotTest(pyauto.PyUITest): |
| - """Test for tracking unknown share in the DevTools native memory snapshots. |
| +class DevToolsTestBase(pyauto.PyUITest): |
| + """Base class for DevTools tests that use replay server |
|
dennis_jeffrey
2012/10/04 01:16:33
add period at end of sentence.
yurys
2012/10/04 15:07:47
Done.
|
| - This test navigates the browser to a test page, then takes native memory |
| - snapshot over remote debugging protocol and prints render process private |
| - memory size and unknown size extracted from the snapshot. It is used to |
| - track size of the memory that is not counted by DevTools memory |
| - instrumentation. |
| + This class allows to navigate the browser to a test page and take native |
| + memory snapshot over remote debugging protocol. |
| The test uses Web Page Replay server as a proxy that allows to replay |
| the same state of the test pages and avoid heavy network traffic on the |
| @@ -58,34 +56,19 @@ class DevToolsNativeMemorySnapshotTest(pyauto.PyUITest): |
| logging.info('Terminating connection to remote inspector...') |
| self._remote_inspector_client.Stop() |
| logging.info('Connection to remote inspector terminated.') |
| - super(DevToolsNativeMemorySnapshotTest, self).tearDown() |
| + super(DevToolsTestBase, self).tearDown() |
| - def testNytimes(self): |
| - self._RunTestWithUrl('http://www.nytimes.com/') |
| - |
| - def testCnn(self): |
| - self._RunTestWithUrl('http://www.cnn.com/') |
| - |
| - def testGoogle(self): |
| - self._RunTestWithUrl('http://www.google.com/') |
| - |
| - def _RunTestWithUrl(self, url): |
| - """Dumps native memory snapshot data for given page.""" |
| + def RunTestWithUrl(self, url): |
| + """Navigates browser to given URL and takes native memory snapshot.""" |
| replay_options = None |
| hostname = urlparse(url).hostname |
| archive_path = os.path.join(self.DATA_PATH, hostname + '.wpr') |
| with webpagereplay.ReplayServer(archive_path, replay_options): |
| self.NavigateToURL(url) |
| snapshot = self._remote_inspector_client.GetProcessMemoryDistribution() |
| - total = snapshot.GetProcessPrivateMemorySize() |
| - unknown = snapshot.GetUnknownSize() |
| - logging.info('Got data for url: %s, total size = %d, unknown size = %d '% |
| - (url, total, unknown)) |
| - |
| - graph_name = 'DevTools Native Snapshot - ' + hostname |
| - pyauto_utils.PrintPerfResult(graph_name, 'Total', total, 'bytes') |
| - pyauto_utils.PrintPerfResult(graph_name, 'Unknown', unknown, 'bytes') |
| + logging.info('Got snapshot for url: %s' % url) |
| + self.PrintTestResult(hostname, snapshot) |
| + def PrintTestResult(self, hostname, snapshot): |
| + pass |
|
dennis_jeffrey
2012/10/04 01:16:33
maybe add a comment that says this is expected to
yurys
2012/10/04 15:07:47
Done.
|
| -if __name__ == '__main__': |
| - pyauto_functional.Main() |