OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import ctypes | 6 import ctypes |
7 import email | 7 import email |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import platform | 10 import platform |
(...skipping 26 matching lines...) Expand all Loading... |
37 """Copy a file from data directory to downloads directory. | 37 """Copy a file from data directory to downloads directory. |
38 | 38 |
39 Args: | 39 Args: |
40 test: derived from pyauto.PyUITest - base class for UI test cases. | 40 test: derived from pyauto.PyUITest - base class for UI test cases. |
41 path: path of the file relative to the data directory | 41 path: path of the file relative to the data directory |
42 """ | 42 """ |
43 data_file = os.path.join(test.DataDir(), file_path) | 43 data_file = os.path.join(test.DataDir(), file_path) |
44 download_dir = test.GetDownloadDirectory().value() | 44 download_dir = test.GetDownloadDirectory().value() |
45 shutil.copy(data_file, download_dir) | 45 shutil.copy(data_file, download_dir) |
46 | 46 |
| 47 |
| 48 def CopyFileFromContentDataDirToDownloadDir(test, file_path): |
| 49 """Copy a file from content data directory to downloads directory. |
| 50 |
| 51 Args: |
| 52 test: derived from pyauto.PyUITest - base class for UI test cases. |
| 53 path: path of the file relative to the data directory |
| 54 """ |
| 55 data_file = os.path.join(test.ContentDataDir(), file_path) |
| 56 download_dir = test.GetDownloadDirectory().value() |
| 57 shutil.copy(data_file, download_dir) |
| 58 |
| 59 |
47 def DownloadFileFromDownloadsDataDir(test, file_name): | 60 def DownloadFileFromDownloadsDataDir(test, file_name): |
48 """Download a file from downloads data directory, in first tab, first window. | 61 """Download a file from downloads data directory, in first tab, first window. |
49 | 62 |
50 Args: | 63 Args: |
51 test: derived from pyauto.PyUITest - base class for UI test cases. | 64 test: derived from pyauto.PyUITest - base class for UI test cases. |
52 file_name: name of file to download. | 65 file_name: name of file to download. |
53 """ | 66 """ |
54 file_url = test.GetFileURLForDataPath(os.path.join('downloads', file_name)) | 67 file_url = test.GetFileURLForDataPath(os.path.join('downloads', file_name)) |
55 downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), | 68 downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), |
56 file_name) | 69 file_name) |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 """This test opens crosh. | 455 """This test opens crosh. |
443 | 456 |
444 This function assumes that no browser windows are open. | 457 This function assumes that no browser windows are open. |
445 """ | 458 """ |
446 self.assertEqual(0, self.GetBrowserWindowCount()) | 459 self.assertEqual(0, self.GetBrowserWindowCount()) |
447 self.OpenCrosh() | 460 self.OpenCrosh() |
448 self.assertEqual(1, self.GetBrowserWindowCount()) | 461 self.assertEqual(1, self.GetBrowserWindowCount()) |
449 self.assertEqual(1, self.GetTabCount(), | 462 self.assertEqual(1, self.GetTabCount(), |
450 msg='Could not open crosh') | 463 msg='Could not open crosh') |
451 self.assertEqual('crosh', self.GetActiveTabTitle()) | 464 self.assertEqual('crosh', self.GetActiveTabTitle()) |
OLD | NEW |