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 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 self.WaitUntil( | 3961 self.WaitUntil( |
3962 lambda: len(self.GetMultiProfileInfo()['profiles']), | 3962 lambda: len(self.GetMultiProfileInfo()['profiles']), |
3963 expect_retval=(num_profiles + 1)) | 3963 expect_retval=(num_profiles + 1)) |
3964 | 3964 |
3965 def OpenProfileWindow(self, path, num_loads=1): | 3965 def OpenProfileWindow(self, path, num_loads=1): |
3966 """Open browser window for an existing profile. | 3966 """Open browser window for an existing profile. |
3967 | 3967 |
3968 This is equivalent to picking a profile from the multi-profile menu. | 3968 This is equivalent to picking a profile from the multi-profile menu. |
3969 | 3969 |
3970 Multi-profile should be enabled and the requested profile should already | 3970 Multi-profile should be enabled and the requested profile should already |
3971 exist. If a window for the given profile already exists, it'll merely get | 3971 exist. Creates a new window for the given profile. Use |
3972 activated. Use OpenNewBrowserWindowWithNewProfile() to create a new profile. | 3972 OpenNewBrowserWindowWithNewProfile() to create a new profile. |
3973 | 3973 |
3974 Args: | 3974 Args: |
3975 path: profile path of the profile to be opened. | 3975 path: profile path of the profile to be opened. |
3976 num_loads: the number of loads to wait for, when a new browser window | 3976 num_loads: the number of loads to wait for, when a new browser window |
3977 is created. Useful when restoring a window with many tabs. | 3977 is created. Useful when restoring a window with many tabs. |
3978 """ | 3978 """ |
3979 cmd_dict = { # Prepare command for the json interface | 3979 cmd_dict = { # Prepare command for the json interface |
3980 'command': 'OpenProfileWindow', | 3980 'command': 'OpenProfileWindow', |
3981 'path': path, | 3981 'path': path, |
3982 'num_loads': num_loads, | 3982 'num_loads': num_loads, |
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6002 successful = result.wasSuccessful() | 6002 successful = result.wasSuccessful() |
6003 if not successful: | 6003 if not successful: |
6004 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6004 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6005 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6005 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6006 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6006 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6007 sys.exit(not successful) | 6007 sys.exit(not successful) |
6008 | 6008 |
6009 | 6009 |
6010 if __name__ == '__main__': | 6010 if __name__ == '__main__': |
6011 Main() | 6011 Main() |
OLD | NEW |