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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 724 |
725 | 725 |
726 class TabPerfTest(BasePerfTest): | 726 class TabPerfTest(BasePerfTest): |
727 """Tests that involve opening tabs.""" | 727 """Tests that involve opening tabs.""" |
728 | 728 |
729 def testNewTab(self): | 729 def testNewTab(self): |
730 """Measures time to open a new tab.""" | 730 """Measures time to open a new tab.""" |
731 self._RunNewTabTest('NewTabPage', | 731 self._RunNewTabTest('NewTabPage', |
732 lambda: self._AppendTab('chrome://newtab'), 'open_tab') | 732 lambda: self._AppendTab('chrome://newtab'), 'open_tab') |
733 | 733 |
734 def testNewTabPdf(self): | |
735 """Measures time to open a new tab navigated to a PDF file.""" | |
736 self.assertTrue( | |
737 os.path.exists(os.path.join(self.DataDir(), 'pyauto_private', 'pdf', | |
738 'TechCrunch.pdf')), | |
739 msg='Missing required PDF data file.') | |
740 url = self.GetFileURLForDataPath('pyauto_private', 'pdf', 'TechCrunch.pdf') | |
741 self._RunNewTabTest('NewTabPdfPage', lambda: self._AppendTab(url), | |
742 'open_tab') | |
743 | |
744 def testNewTabFlash(self): | 734 def testNewTabFlash(self): |
745 """Measures time to open a new tab navigated to a flash page.""" | 735 """Measures time to open a new tab navigated to a flash page.""" |
746 self.assertTrue( | 736 self.assertTrue( |
747 os.path.exists(os.path.join(self.ContentDataDir(), 'plugin', | 737 os.path.exists(os.path.join(self.ContentDataDir(), 'plugin', |
748 'flash.swf')), | 738 'flash.swf')), |
749 msg='Missing required flash data file.') | 739 msg='Missing required flash data file.') |
750 url = self.GetFileURLForContentDataPath('plugin', 'flash.swf') | 740 url = self.GetFileURLForContentDataPath('plugin', 'flash.swf') |
751 self._RunNewTabTest('NewTabFlashPage', lambda: self._AppendTab(url), | 741 self._RunNewTabTest('NewTabFlashPage', lambda: self._AppendTab(url), |
752 'open_tab') | 742 'open_tab') |
753 | 743 |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 """Identifies the port number to which the server is currently bound. | 2640 """Identifies the port number to which the server is currently bound. |
2651 | 2641 |
2652 Returns: | 2642 Returns: |
2653 The numeric port number to which the server is currently bound. | 2643 The numeric port number to which the server is currently bound. |
2654 """ | 2644 """ |
2655 return self._server.server_address[1] | 2645 return self._server.server_address[1] |
2656 | 2646 |
2657 | 2647 |
2658 if __name__ == '__main__': | 2648 if __name__ == '__main__': |
2659 pyauto_functional.Main() | 2649 pyauto_functional.Main() |
OLD | NEW |