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 """PyAuto: Python Interface to Chromium's Automation Proxy. | 6 """PyAuto: Python Interface to Chromium's Automation Proxy. |
7 | 7 |
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. | 8 PyAuto uses swig to expose Automation Proxy interfaces to Python. |
9 For complete documentation on the functionality available, | 9 For complete documentation on the functionality available, |
10 run pydoc on this file. | 10 run pydoc on this file. |
(...skipping 4008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4019 }); | 4019 }); |
4020 """ % form_id | 4020 """ % form_id |
4021 if self.ExecuteJavascript(js, tab_index, windex, frame_xpath) != 'done': | 4021 if self.ExecuteJavascript(js, tab_index, windex, frame_xpath) != 'done': |
4022 return False | 4022 return False |
4023 # Wait until the form is submitted and the page completes loading. | 4023 # Wait until the form is submitted and the page completes loading. |
4024 return self.WaitUntil( | 4024 return self.WaitUntil( |
4025 lambda: self.GetDOMValue('document.readyState', | 4025 lambda: self.GetDOMValue('document.readyState', |
4026 tab_index, windex, frame_xpath), | 4026 tab_index, windex, frame_xpath), |
4027 expect_retval='complete') | 4027 expect_retval='complete') |
4028 | 4028 |
4029 def SimulateAsanMemoryBug(self): | |
4030 """ Simulates a memory bug (reference an array out of bounds) to cause | |
Nirnimesh
2012/05/17 20:02:37
Remove space after """
Make first sentence a one-l
glotov
2012/05/18 09:48:05
Done.
| |
4031 Address Sanitizer (if it was built it) to catch the bug and abort | |
4032 the process. | |
Nirnimesh
2012/05/17 20:02:37
Make a note about the increased timeout
glotov
2012/05/18 09:48:05
Done, as discussed.
On 2012/05/17 20:02:37, Nirni
| |
4033 """ | |
4034 timeout = PyUITest.ActionTimeoutChanger(self, 3 * 60 * 1000) | |
4035 cmd_dict = { 'command': 'SimulateAsanMemoryBug' } | |
4036 self._GetResultFromJSONRequest(cmd_dict, windex=None) | |
4037 | |
4029 ## ChromeOS section | 4038 ## ChromeOS section |
4030 | 4039 |
4031 def GetLoginInfo(self): | 4040 def GetLoginInfo(self): |
4032 """Returns information about login and screen locker state. | 4041 """Returns information about login and screen locker state. |
4033 | 4042 |
4034 This includes things like whether a user is logged in, the username | 4043 This includes things like whether a user is logged in, the username |
4035 of the logged in user, and whether the screen is locked. | 4044 of the logged in user, and whether the screen is locked. |
4036 | 4045 |
4037 Returns: | 4046 Returns: |
4038 A dictionary. | 4047 A dictionary. |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5765 successful = result.wasSuccessful() | 5774 successful = result.wasSuccessful() |
5766 if not successful: | 5775 if not successful: |
5767 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 5776 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
5768 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 5777 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
5769 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 5778 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
5770 sys.exit(not successful) | 5779 sys.exit(not successful) |
5771 | 5780 |
5772 | 5781 |
5773 if __name__ == '__main__': | 5782 if __name__ == '__main__': |
5774 Main() | 5783 Main() |
OLD | NEW |