OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 """Common imports, setup, etc for chromoting tests.""" | |
6 | |
7 import os | |
8 | |
9 | |
10 def _SetupPaths(): | |
11 """Add chrome/test/functional to sys.path for importing pyauto_functional""" | |
12 functional_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
13 os.sys.path.append(functional_dir) | |
14 | |
15 _SetupPaths() | |
16 | |
17 | |
18 import pyauto_functional # Must come before chromoting and pyauto. | |
19 from pyauto_functional import Main | |
20 import pyauto | |
21 import chromotinglib | |
22 | |
23 | |
24 class ChromotingBase(chromotinglib.ChromotingMixIn, pyauto.PyUITest): | |
25 """Chromoting pyauto test base class. | |
26 | |
27 The following member variables can be used in the child classes: | |
28 client_local: True if the client is on the same machines as host | |
29 host: The chromoting host side, instance of ChromotingBase | |
30 client: The chromoting client side, intance of ChromotingBase | |
31 client_tab_index: The tab index to the chromoting client tab | |
32 """ | |
33 def __init__(self, methodName): | |
34 pyauto.PyUITest.__init__(self, methodName) | |
35 | |
36 self.client_local = (self.remote == None) | |
37 self.host = self | |
38 self.client = self if self.client_local else self.remote | |
39 self.client_tab_index = 2 if self.client_local else 1 | |
40 | |
41 def ExtraChromeFlags(self): | |
42 """Add extra flags for chromoting testing. | |
43 | |
44 Add --allow-nacl-socket-api to connect chromoting successfully. | |
45 """ | |
46 extra_chrome_flags = ['--allow-nacl-socket-api=*'] | |
47 return pyauto.PyUITest.ExtraChromeFlags(self) + extra_chrome_flags | |
OLD | NEW |