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 |
11 import shutil | 11 import shutil |
12 import smtplib | 12 import smtplib |
13 import subprocess | 13 import subprocess |
14 import sys | 14 import sys |
15 import types | 15 import types |
16 | 16 |
17 import pyauto_functional | 17 import pyauto_functional |
18 import pyauto | 18 import pyauto |
19 import pyauto_utils | 19 import pyauto_utils |
20 | 20 |
21 | 21 |
22 """Commonly used functions for PyAuto tests.""" | 22 """Commonly used functions for PyAuto tests.""" |
23 | 23 |
24 def CrashBrowser(test): | 24 def CrashBrowser(test): |
25 """Crashes the browser by navigating to special URL.""" | 25 """Crashes the browser by navigating to special URL.""" |
26 test.NavigateToURL('about:inducebrowsercrashforrealz') | 26 test.NavigateToURL('chrome://inducebrowsercrashforrealz') |
27 | 27 |
28 | 28 |
29 def CopyFileFromDataDirToDownloadDir(test, file_path): | 29 def CopyFileFromDataDirToDownloadDir(test, file_path): |
30 """Copy a file from data directory to downloads directory. | 30 """Copy a file from data directory to downloads directory. |
31 | 31 |
32 Args: | 32 Args: |
33 test: derived from pyauto.PyUITest - base class for UI test cases. | 33 test: derived from pyauto.PyUITest - base class for UI test cases. |
34 path: path of the file relative to the data directory | 34 path: path of the file relative to the data directory |
35 """ | 35 """ |
36 data_file = os.path.join(test.DataDir(), file_path) | 36 data_file = os.path.join(test.DataDir(), file_path) |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 test: Derived from pyauto.PyUITest - base class for UI test cases. | 416 test: Derived from pyauto.PyUITest - base class for UI test cases. |
417 infobar_type: The infobar type to look for. | 417 infobar_type: The infobar type to look for. |
418 windex: Window index. Defaults to 0 (first window). | 418 windex: Window index. Defaults to 0 (first window). |
419 tab_index: Tab index. Defaults to 0 (first tab). | 419 tab_index: Tab index. Defaults to 0 (first tab). |
420 """ | 420 """ |
421 test.assertFalse( | 421 test.assertFalse( |
422 test.WaitUntil(lambda: GetInfobarIndexByType( | 422 test.WaitUntil(lambda: GetInfobarIndexByType( |
423 test, infobar_type, windex, tab_index) is not None, timeout=20), | 423 test, infobar_type, windex, tab_index) is not None, timeout=20), |
424 msg=('Infobar type for %s appeared when it should be hidden.' | 424 msg=('Infobar type for %s appeared when it should be hidden.' |
425 % infobar_type)) | 425 % infobar_type)) |
OLD | NEW |