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

Side by Side Diff: chrome/test/functional/perf.py

Issue 10500010: Rename WebPageReplayPageCyclerTest to PageCyclerNetSimTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Basic pyauto performance tests. 6 """Basic pyauto performance tests.
7 7
8 For tests that need to be run for multiple iterations (e.g., so that average 8 For tests that need to be run for multiple iterations (e.g., so that average
9 and standard deviation values can be reported), the default number of iterations 9 and standard deviation values can be reported), the default number of iterations
10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. 10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|.
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 def testIntl2File(self): 2049 def testIntl2File(self):
2050 self.RunPageCyclerTest('intl2', 'Intl2File') 2050 self.RunPageCyclerTest('intl2', 'Intl2File')
2051 2051
2052 def testMozFile(self): 2052 def testMozFile(self):
2053 self.RunPageCyclerTest('moz', 'MozFile') 2053 self.RunPageCyclerTest('moz', 'MozFile')
2054 2054
2055 def testMoz2File(self): 2055 def testMoz2File(self):
2056 self.RunPageCyclerTest('moz2', 'Moz2File') 2056 self.RunPageCyclerTest('moz2', 'Moz2File')
2057 2057
2058 2058
2059 class WebPageReplayPageCyclerTest(BasePageCyclerTest): 2059 class PageCyclerNetSimTest(BasePageCyclerTest):
2060 """Tests to run Web Page Replay backed page cycler tests. 2060 """Run page cycler tests with network simulation via Web Page Replay.
2061 2061
2062 Web Page Replay is a proxy that can record and "replay" web pages with 2062 Web Page Replay is a proxy that can record and "replay" web pages with
2063 simulated network characteristics -- without having to edit the pages 2063 simulated network characteristics -- without having to edit the pages
2064 by hand. With WPR, tests can use "real" web content, and catch 2064 by hand. With WPR, tests can use "real" web content, and catch
2065 performance issues that may result from introducing network delays and 2065 performance issues that may result from introducing network delays and
2066 bandwidth throttling. 2066 bandwidth throttling.
2067 2067
2068 Setting 'PC_NO_AUTO=1' in the environment avoids automatically running 2068 Setting 'PC_NO_AUTO=1' in the environment avoids automatically running
2069 through all the pages. 2069 through all the pages.
2070 Setting 'PC_RECORD=1' puts WPR in record mode. 2070 Setting 'PC_RECORD=1' puts WPR in record mode.
2071 """ 2071 """
2072 _PATHS = { 2072 _PATHS = {
2073 'archives': 'src/data/page_cycler/webpagereplay', 2073 'archives': 'src/data/page_cycler/webpagereplay',
2074 'wpr': 'src/data/page_cycler/webpagereplay/{test_name}.wpr', 2074 'wpr': 'src/data/page_cycler/webpagereplay/{test_name}.wpr',
2075 'wpr_pub': 'src/tools/page_cycler/webpagereplay/tests/{test_name}.wpr', 2075 'wpr_pub': 'src/tools/page_cycler/webpagereplay/tests/{test_name}.wpr',
2076 'start_page': 'src/tools/page_cycler/webpagereplay/start.html', 2076 'start_page': 'src/tools/page_cycler/webpagereplay/start.html',
2077 'extension': 'src/tools/page_cycler/webpagereplay/extension', 2077 'extension': 'src/tools/page_cycler/webpagereplay/extension',
2078 'replay': 'src/third_party/webpagereplay', 2078 'replay': 'src/third_party/webpagereplay',
2079 'logs': 'src/webpagereplay_logs', 2079 'logs': 'src/webpagereplay_logs',
2080 } 2080 }
2081 2081
2082 _BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 2082 _BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
2083 '..', '..', '..', '..')) 2083 '..', '..', '..', '..'))
2084 _IS_DNS_FORWARDED = False 2084 _IS_DNS_FORWARDED = False
2085 MAX_ITERATION_SECONDS = 180 2085 MAX_ITERATION_SECONDS = 180
2086 2086
2087 def setUp(self): 2087 def setUp(self):
2088 """Performs necessary setup work before running each test.""" 2088 """Performs necessary setup work before running each test."""
2089 super(WebPageReplayPageCyclerTest, self).setUp() 2089 super(PageCyclerNetSimTest, self).setUp()
2090 self.replay_dir = os.environ.get('PC_REPLAY_DIR') 2090 self.replay_dir = os.environ.get('PC_REPLAY_DIR')
2091 self.is_record_mode = 'PC_RECORD' in os.environ 2091 self.is_record_mode = 'PC_RECORD' in os.environ
2092 if self.is_record_mode: 2092 if self.is_record_mode:
2093 self._num_iterations = 1 2093 self._num_iterations = 1
2094 2094
2095 @classmethod 2095 @classmethod
2096 def _Path(cls, key, **kwargs): 2096 def _Path(cls, key, **kwargs):
2097 """Provide paths for page cycler tests with Web Page Replay.""" 2097 """Provide paths for page cycler tests with Web Page Replay."""
2098 chromium_path = cls._PATHS[key].format(**kwargs) 2098 chromium_path = cls._PATHS[key].format(**kwargs)
2099 return os.path.join(cls._BASE_DIR, *chromium_path.split('/')) 2099 return os.path.join(cls._BASE_DIR, *chromium_path.split('/'))
2100 2100
2101 @classmethod 2101 @classmethod
2102 def _ArchivePath(cls, test_name): 2102 def _ArchivePath(cls, test_name):
2103 has_private_archives = os.path.exists(cls._Path('archives')) 2103 has_private_archives = os.path.exists(cls._Path('archives'))
2104 key = 'wpr' if has_private_archives else 'wpr_pub' 2104 key = 'wpr' if has_private_archives else 'wpr_pub'
2105 return cls._Path(key, test_name=test_name) 2105 return cls._Path(key, test_name=test_name)
2106 2106
2107 def ExtraChromeFlags(self): 2107 def ExtraChromeFlags(self):
2108 """Ensures Chrome is launched with custom flags. 2108 """Ensures Chrome is launched with custom flags.
2109 2109
2110 Returns: 2110 Returns:
2111 A list of extra flags to pass to Chrome when it is launched. 2111 A list of extra flags to pass to Chrome when it is launched.
2112 """ 2112 """
2113 flags = super(WebPageReplayPageCyclerTest, self).ExtraChromeFlags() 2113 flags = super(PageCyclerNetSimTest, self).ExtraChromeFlags()
2114 flags.append('--load-extension=%s' % self._Path('extension')) 2114 flags.append('--load-extension=%s' % self._Path('extension'))
2115 if not self._IS_DNS_FORWARDED: 2115 if not self._IS_DNS_FORWARDED:
2116 flags.append('--host-resolver-rules=MAP * %s' % webpagereplay.REPLAY_HOST) 2116 flags.append('--host-resolver-rules=MAP * %s' % webpagereplay.REPLAY_HOST)
2117 flags.extend([ 2117 flags.extend([
2118 '--testing-fixed-http-port=%s' % webpagereplay.HTTP_PORT, 2118 '--testing-fixed-http-port=%s' % webpagereplay.HTTP_PORT,
2119 '--testing-fixed-https-port=%s' % webpagereplay.HTTPS_PORT, 2119 '--testing-fixed-https-port=%s' % webpagereplay.HTTPS_PORT,
2120 '--log-level=0', 2120 '--log-level=0',
2121 ]) 2121 ])
2122 extra_flags = [ 2122 extra_flags = [
2123 '--disable-background-networking', 2123 '--disable-background-networking',
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 replay_options.append('--record') 2155 replay_options.append('--record')
2156 if self.replay_dir: 2156 if self.replay_dir:
2157 replay_dir = self.replay_dir 2157 replay_dir = self.replay_dir
2158 else: 2158 else:
2159 self._Path('replay'), 2159 self._Path('replay'),
2160 with webpagereplay.ReplayServer( 2160 with webpagereplay.ReplayServer(
2161 replay_dir, 2161 replay_dir,
2162 self._ArchivePath(test_name), 2162 self._ArchivePath(test_name),
2163 self._Path('logs'), 2163 self._Path('logs'),
2164 replay_options): 2164 replay_options):
2165 super_self = super(WebPageReplayPageCyclerTest, self) 2165 super_self = super(PageCyclerNetSimTest, self)
2166 super_self.RunPageCyclerTest(test_name, description) 2166 super_self.RunPageCyclerTest(test_name, description)
2167 2167
2168 def test2012Q2(self): 2168 def test2012Q2(self):
2169 self.RunPageCyclerTest('2012Q2', '2012Q2') 2169 self.RunPageCyclerTest('2012Q2', '2012Q2')
2170 2170
2171 2171
2172 class MemoryTest(BasePerfTest): 2172 class MemoryTest(BasePerfTest):
2173 """Tests to measure memory consumption under different usage scenarios.""" 2173 """Tests to measure memory consumption under different usage scenarios."""
2174 2174
2175 def ExtraChromeFlags(self): 2175 def ExtraChromeFlags(self):
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 """Identifies the port number to which the server is currently bound. 2502 """Identifies the port number to which the server is currently bound.
2503 2503
2504 Returns: 2504 Returns:
2505 The numeric port number to which the server is currently bound. 2505 The numeric port number to which the server is currently bound.
2506 """ 2506 """
2507 return self._server.server_address[1] 2507 return self._server.server_address[1]
2508 2508
2509 2509
2510 if __name__ == '__main__': 2510 if __name__ == '__main__':
2511 pyauto_functional.Main() 2511 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698