Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / test / functional / chromoting / me2me_connect.py
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 """Chromoting me2me connect/disconnect related test cases."""
7
8 import chromoting_base
9 import pyauto
10
11
12 class Me2MeConnect(chromoting_base.ChromotingBase):
13   """Drives me2me connect test cases."""
14
15   def setUp(self):
16     """Set up for me2me connect test."""
17     # Disable test on vista and xp until the failure is figured
18     if self.IsWinVista() or self.IsWinXP():
19       return
20
21     pyauto.PyUITest.setUp(self)
22
23     self.InstallHostDaemon()
24     webapp = self.InstallExtension(self.GetWebappPath())
25     self.host.LaunchApp(webapp)
26     self.host.Authenticate()
27     self.host.StartMe2Me()
28     self.host.CleanupHostList()
29     self.host.EnableConnectionsInstalled()
30     self.client.LaunchApp(webapp)
31
32   def tearDown(self):
33     """Mainly uninstalls the host daemon."""
34     # Disable test on vista and xp until the failure is figured
35     if self.IsWinVista() or self.IsWinXP():
36       return
37
38     self.host.DisableConnections()
39     self.UninstallHostDaemon()
40
41     pyauto.PyUITest.tearDown(self)
42
43
44   def testMe2MeConnectDisconnectReconnectDisconnect(self):
45     """Connects, disconnects, reconnects and disconnects"""
46     # Disable test on vista and xp until the failure is figured
47     if self.IsWinVista() or self.IsWinXP():
48       return
49
50     self.client.ConnectMe2Me('111111', 'IN_SESSION',
51                              self.client_tab_index)
52     self.client.DisconnectMe2Me(False, self.client_tab_index)
53     self.client.ReconnectMe2Me('111111', self.client_tab_index)
54     self.client.DisconnectMe2Me(True, self.client_tab_index)
55
56   def testMe2MeConnectWithWrongPin(self):
57     """Connects and disconnects."""
58     # Disable test on vista and xp until the failure is figured
59     if self.IsWinVista() or self.IsWinXP():
60       return
61
62     self.client.ConnectMe2Me('222222', 'CLIENT_CONNECT_FAILED_ME2ME',
63                              self.client_tab_index)
64     self.client.ReconnectMe2Me('111111', self.client_tab_index)
65     self.client.DisconnectMe2Me(True, self.client_tab_index)
66
67   def testMe2MeChangePin(self):
68     """Changes pin, connects with new pin and then disconnects."""
69     # Disable test on vista and xp until the failure is figured
70     if self.IsWinVista() or self.IsWinXP():
71       return
72
73     self.host.ChangePin('222222')
74     self.client.ConnectMe2Me('222222', 'IN_SESSION',
75                              self.client_tab_index)
76     self.client.DisconnectMe2Me(True, self.client_tab_index)
77
78   def testMe2MeChangeName(self):
79     """Changes host name, connects and then disconnects."""
80     # Disable test on vista and xp until the failure is figured
81     if self.IsWinVista() or self.IsWinXP():
82       return
83
84     self.client.ChangeName("Changed")
85     self.client.ConnectMe2Me('111111', 'IN_SESSION',
86                              self.client_tab_index)
87     self.client.DisconnectMe2Me(True, self.client_tab_index)
88
89
90 if __name__ == '__main__':
91   chromoting_base.Main()