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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/functional/find_in_page.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/test_utils.py
===================================================================
--- chrome/test/functional/test_utils.py (revision 0)
+++ chrome/test/functional/test_utils.py (revision 0)
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import unittest
+
+import pyauto_functional # Must be imported before pyauto
+import pyauto
+
+
+"""Commonly used functions for PyAuto tests."""
+
+def DownloadTestFile(test, file_name):
+ """Download a zip file."""
+ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads')
+ file_path = os.path.join(download_dir, file_name)
+ file_url = test.GetFileURLForPath(file_path)
+ downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(),
+ file_name)
+ # Check if zip file already exists. If so then delete it.
+ if os.path.exists(downloaded_pkg):
+ self.RemoveTestFile(test, file_name)
+ test.DownloadAndWaitForStart(file_url)
+ # Wait for the download to finish
+ test.WaitForAllDownloadsToComplete()
+
+def RemoveTestFile(test, file_name):
+ """Delete a file from the downloads directory."""
+ downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(),
+ file_name)
+ os.remove(downloaded_pkg)
+
+if __name__ == '__main__':
+ Main()
« 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