OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import os | |
7 | |
8 import pyauto_functional # Must come before chromoting and pyauto. | |
9 import chromoting | |
10 import pyauto | |
11 | |
12 | |
13 class ChromotingBasic(chromoting.ChromotingMixIn, pyauto.PyUITest): | |
14 """Basic tests for Chromoting.""" | |
15 | |
16 _EXTRA_CHROME_FLAGS = [ | |
17 '--allow-nacl-socket-api=*', | |
18 ] | |
19 | |
20 def ExtraChromeFlags(self): | |
21 """Ensures Chrome is launched with some custom flags. | |
22 | |
23 Overrides the default list of extra flags passed to Chrome. See | |
24 ExtraChromeFlags() in pyauto.py. | |
25 """ | |
26 return pyauto.PyUITest.ExtraChromeFlags(self) + self._EXTRA_CHROME_FLAGS | |
27 | |
28 def setUp(self): | |
29 """Set up test for Chromoting on both local and remote machines. | |
30 | |
31 Installs the Chromoting app, launches it, and authenticates | |
32 using the default Chromoting test account. | |
33 """ | |
34 super(ChromotingBasic, self).setUp() | |
35 self._app = self.InstallExtension(self.GetWebappPath()) | |
36 self.LaunchApp(self._app) | |
37 account = self.GetPrivateInfo()['test_chromoting_account'] | |
38 self.Authenticate(account['username'], account['password']) | |
39 | |
40 def testChromoting(self): | |
41 """Verify that we can start and disconnect from a Chromoting session.""" | |
42 client_local = (self.remote == None) | |
43 host = self | |
44 client = self if client_local else self.remote | |
45 client_tab_index = 2 if client_local else 1 | |
46 | |
47 access_code = host.Share() | |
48 self.assertTrue(access_code, | |
49 msg='Host attempted to share, but it failed. ' | |
50 'No access code was found.') | |
51 | |
52 if client_local: | |
53 client.LaunchApp(self._app) | |
54 | |
55 self.assertTrue(client.Connect(access_code, True, client_tab_index), | |
56 msg='The client attempted to connect to the host, ' | |
57 'but the chromoting session did not start.') | |
58 | |
59 host.CancelShare() | |
60 client.Disconnect(client_tab_index) | |
61 | |
62 | |
63 if __name__ == '__main__': | |
64 pyauto_functional.Main() | |
OLD | NEW |