summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional/chromoting_basic.py
blob: 4bb30f9c2fc613c9f764d50f6e788ff6b29e8cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

import pyauto_functional  # Must come before chromoting and pyauto.
import chromoting
import pyauto


class ChromotingBasic(chromoting.ChromotingMixIn, pyauto.PyUITest):
  """Basic tests for Chromoting."""

  def setUp(self):
    """Set up test for Chromoting on both local and remote machines.

    Installs the Chromoting app, launches it, and authenticates
    using the default Chromoting test account.
    """
    super(ChromotingBasic, self).setUp()
    app = self.InstallApp(self.GetIT2MeAppPath())
    self.LaunchApp(app)
    account = self.GetPrivateInfo()['test_chromoting_account']
    self.Authenticate(account['username'], account['password'])

  def testChromoting(self):
    """Verify that we can start and disconnect from a Chromoting session."""
    host = self
    client = self.remote

    host.SetHostMode()
    access_code = host.Share()
    self.assertTrue(access_code,
                    msg='Host attempted to share, but it failed. '
                        'No access code was found.')

    client.SetClientMode()
    self.assertTrue(client.Connect(access_code),
                    msg='The client attempted to connect to the host, '
                        'but the chromoting session did not start.')

    host.CancelShare()
    client.Disconnect()


if __name__ == '__main__':
  pyauto_functional.Main()