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

Side by Side Diff: chrome/test/functional/test_utils.py

Issue 4166006: moved commonly used private functions to it's own utility file. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/find_in_page.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
(Empty)
1 #!/usr/bin/python
2
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 import os
8 import unittest
9
10 import pyauto_functional # Must be imported before pyauto
11 import pyauto
12
13
14 """Commonly used functions for PyAuto tests."""
15
16 def DownloadTestFile(test, file_name):
17 """Download a zip file."""
18 download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads')
19 file_path = os.path.join(download_dir, file_name)
20 file_url = test.GetFileURLForPath(file_path)
21 downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(),
22 file_name)
23 # Check if zip file already exists. If so then delete it.
24 if os.path.exists(downloaded_pkg):
25 self.RemoveTestFile(test, file_name)
26 test.DownloadAndWaitForStart(file_url)
27 # Wait for the download to finish
28 test.WaitForAllDownloadsToComplete()
29
30 def RemoveTestFile(test, file_name):
31 """Delete a file from the downloads directory."""
32 downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(),
33 file_name)
34 os.remove(downloaded_pkg)
35
36 if __name__ == '__main__':
37 Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/find_in_page.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698