Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 10866013: Convert the browsing_data pyauto tests to chrome tests. Remove the ClearBrowsingData automation cod… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix hang on mac Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/test_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3307 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3308 """ 3308 """
3309 cmd_dict = { # Prepare command for the json interface 3309 cmd_dict = { # Prepare command for the json interface
3310 'command': 'ImportSettings', 3310 'command': 'ImportSettings',
3311 'import_from': import_from, 3311 'import_from': import_from,
3312 'first_run': first_run, 3312 'first_run': first_run,
3313 'import_items': import_items 3313 'import_items': import_items
3314 } 3314 }
3315 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) 3315 return self._GetResultFromJSONRequest(cmd_dict, windex=windex)
3316 3316
3317 def ClearBrowsingData(self, to_remove, time_period):
3318 """Clear the specified browsing data. Implements the features available in
3319 the "ClearBrowsingData" UI.
3320
3321 Args:
3322 to_remove: a list of strings indicating which types of browsing data
3323 should be removed. Strings that can be in the list are:
3324 HISTORY, DOWNLOADS, COOKIES, PASSWORDS, FORM_DATA, CACHE
3325 time_period: a string indicating the time period for the removal.
3326 Possible strings are:
3327 LAST_HOUR, LAST_DAY, LAST_WEEK, FOUR_WEEKS, EVERYTHING
3328
3329 Raises:
3330 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3331 """
3332 cmd_dict = { # Prepare command for the json interface
3333 'command': 'ClearBrowsingData',
3334 'to_remove': to_remove,
3335 'time_period': time_period
3336 }
3337 return self._GetResultFromJSONRequest(cmd_dict)
3338
3339 def AddSavedPassword(self, password_dict, windex=0): 3317 def AddSavedPassword(self, password_dict, windex=0):
3340 """Adds the given username-password combination to the saved passwords. 3318 """Adds the given username-password combination to the saved passwords.
3341 3319
3342 Args: 3320 Args:
3343 password_dict: a dictionary that represents a password. Example: 3321 password_dict: a dictionary that represents a password. Example:
3344 { 'username_value': 'user@example.com', # Required 3322 { 'username_value': 'user@example.com', # Required
3345 'password_value': 'test.password', # Required 3323 'password_value': 'test.password', # Required
3346 'signon_realm': 'https://www.example.com/', # Required 3324 'signon_realm': 'https://www.example.com/', # Required
3347 'time': 1279317810.0, # Can get from time.time() 3325 'time': 1279317810.0, # Can get from time.time()
3348 'origin_url': 'https://www.example.com/login', 3326 'origin_url': 'https://www.example.com/login',
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
6717 successful = result.wasSuccessful() 6695 successful = result.wasSuccessful()
6718 if not successful: 6696 if not successful:
6719 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 6697 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
6720 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 6698 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
6721 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 6699 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
6722 sys.exit(not successful) 6700 sys.exit(not successful)
6723 6701
6724 6702
6725 if __name__ == '__main__': 6703 if __name__ == '__main__':
6726 Main() 6704 Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/test_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698