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 """Performance tests for Chrome Endure (long-running perf tests on Chrome). | 6 """Performance tests for Chrome Endure (long-running perf tests on Chrome). |
7 """ | 7 """ |
8 | 8 |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 """ | 66 """ |
67 info = self.GetProcessInfo() | 67 info = self.GetProcessInfo() |
68 tab_proc_info = [] | 68 tab_proc_info = [] |
69 for browser_info in info['browsers']: | 69 for browser_info in info['browsers']: |
70 for proc_info in browser_info['processes']: | 70 for proc_info in browser_info['processes']: |
71 if (proc_info['child_process_type'] == 'Tab' and | 71 if (proc_info['child_process_type'] == 'Tab' and |
72 [x for x in proc_info['titles'] if tab_title_substring in x]): | 72 [x for x in proc_info['titles'] if tab_title_substring in x]): |
73 tab_proc_info.append(proc_info) | 73 tab_proc_info.append(proc_info) |
74 self.assertEqual(len(tab_proc_info), 1, | 74 self.assertEqual(len(tab_proc_info), 1, |
75 msg='Expected to find 1 %s tab process, but found %d ' | 75 msg='Expected to find 1 %s tab process, but found %d ' |
76 'instead.' % (tab_title_substring, len(tab_proc_info))) | 76 'instead.\nCurrent process info:\n%s.' % ( |
| 77 tab_title_substring, len(tab_proc_info), |
| 78 self.pformat(info))) |
77 tab_proc_info = tab_proc_info[0] | 79 tab_proc_info = tab_proc_info[0] |
78 return { | 80 return { |
79 'private_mem': tab_proc_info['working_set_mem']['priv'] | 81 'private_mem': tab_proc_info['working_set_mem']['priv'] |
80 } | 82 } |
81 | 83 |
82 def _GetPerformanceStats(self, webapp_name, tab_title_substring): | 84 def _GetPerformanceStats(self, webapp_name, tab_title_substring): |
83 """Gets performance statistics and outputs the results. | 85 """Gets performance statistics and outputs the results. |
84 | 86 |
85 Args: | 87 Args: |
86 webapp_name: A string name for the webapp being tested. Should not | 88 webapp_name: A string name for the webapp being tested. Should not |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 if not self._WaitForElementByXpath( | 438 if not self._WaitForElementByXpath( |
437 driver, wait, '//div[text()="Acquaintances"]'): | 439 driver, wait, '//div[text()="Acquaintances"]'): |
438 num_errors += 1 | 440 num_errors += 1 |
439 time.sleep(1) | 441 time.sleep(1) |
440 | 442 |
441 self._GetPerformanceStats(self._webapp_name, self._tab_title_substring) | 443 self._GetPerformanceStats(self._webapp_name, self._tab_title_substring) |
442 | 444 |
443 | 445 |
444 if __name__ == '__main__': | 446 if __name__ == '__main__': |
445 pyauto_functional.Main() | 447 pyauto_functional.Main() |
OLD | NEW |