OLD | NEW |
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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 def testMozFile(self): | 1761 def testMozFile(self): |
1762 self._RunPageCyclerTest('moz', self._num_iterations, 'MozFile') | 1762 self._RunPageCyclerTest('moz', self._num_iterations, 'MozFile') |
1763 | 1763 |
1764 def testMoz2File(self): | 1764 def testMoz2File(self): |
1765 self._RunPageCyclerTest('moz2', self._num_iterations, 'Moz2File') | 1765 self._RunPageCyclerTest('moz2', self._num_iterations, 'Moz2File') |
1766 | 1766 |
1767 | 1767 |
1768 class MemoryTest(BasePerfTest): | 1768 class MemoryTest(BasePerfTest): |
1769 """Tests to measure memory consumption under different usage scenarios.""" | 1769 """Tests to measure memory consumption under different usage scenarios.""" |
1770 | 1770 |
1771 def setUp(self): | |
1772 pyauto.PyUITest.setUp(self) | |
1773 | |
1774 # Log in to get a fresh Chrome instance with a clean memory state (if | |
1775 # already logged in, log out first). | |
1776 if self.GetLoginInfo()['is_logged_in']: | |
1777 self.Logout() | |
1778 self.assertFalse(self.GetLoginInfo()['is_logged_in'], | |
1779 msg='Failed to log out.') | |
1780 | |
1781 credentials = self.GetPrivateInfo()['test_google_account'] | |
1782 self.Login(credentials['username'], credentials['password']) | |
1783 self.assertTrue(self.GetLoginInfo()['is_logged_in'], | |
1784 msg='Failed to log in.') | |
1785 | |
1786 def ExtraChromeFlags(self): | 1771 def ExtraChromeFlags(self): |
1787 """Launches Chrome with custom flags. | 1772 """Launches Chrome with custom flags. |
1788 | 1773 |
1789 Returns: | 1774 Returns: |
1790 A list of extra flags to pass to Chrome when it is launched. | 1775 A list of extra flags to pass to Chrome when it is launched. |
1791 """ | 1776 """ |
1792 # Ensure Chrome assigns one renderer process to each tab. | 1777 # Ensure Chrome assigns one renderer process to each tab. |
1793 return super(MemoryTest, self).ExtraChromeFlags() + ['--process-per-tab'] | 1778 return super(MemoryTest, self).ExtraChromeFlags() + ['--process-per-tab'] |
1794 | 1779 |
1795 def _GetMemoryStats(self, duration): | 1780 def _GetMemoryStats(self, duration): |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 """Identifies the port number to which the server is currently bound. | 2267 """Identifies the port number to which the server is currently bound. |
2283 | 2268 |
2284 Returns: | 2269 Returns: |
2285 The numeric port number to which the server is currently bound. | 2270 The numeric port number to which the server is currently bound. |
2286 """ | 2271 """ |
2287 return self._server.server_address[1] | 2272 return self._server.server_address[1] |
2288 | 2273 |
2289 | 2274 |
2290 if __name__ == '__main__': | 2275 if __name__ == '__main__': |
2291 pyauto_functional.Main() | 2276 pyauto_functional.Main() |
OLD | NEW |