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 |
| 34 def __init__(self, methodName): |
| 35 pyauto.PyUITest.__init__(self, methodName) |
| 36 |
| 37 self.client_local = (self.remote == None) |
| 38 self.host = self |
| 39 self.client = self if self.client_local else self.remote |
| 40 self.client_tab_index = 2 if self.client_local else 1 |
| 41 |
| 42 def ExtraChromeFlags(self): |
| 43 """Add --allow-nacl-socket-api to connect chromoting successfully.""" |
| 44 extra_chrome_flags = ['--allow-nacl-socket-api=*',] |
| 45 return pyauto.PyUITest.ExtraChromeFlags(self) + extra_chrome_flags |
OLD | NEW |