OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 | 7 |
8 import pyauto_functional | 8 import pyauto_functional |
9 import chromeos_network # pyauto_functional must come before chromeos_network | 9 import chromeos_network # pyauto_functional must come before chromeos_network |
10 | 10 |
11 | 11 |
12 class ChromeosWifiSanity(chromeos_network.PyNetworkUITest): | 12 class ChromeosWifiSanity(chromeos_network.PyNetworkUITest): |
13 """Tests for ChromeOS network related functions.""" | 13 """Tests for ChromeOS network related functions.""" |
14 | 14 |
15 def testNetworkInfoAndScan(self): | |
16 """Get basic info on networks.""" | |
17 # NetworkScan will also call GetNetworkInfo and return the results. | |
18 result = self.NetworkScan() | |
19 self.assertTrue(result) | |
20 logging.debug(result) | |
21 | |
22 def testGetProxySettings(self): | |
23 """Print some information about proxy settings.""" | |
24 result = self.GetProxySettingsOnChromeOS() | |
25 self.assertTrue(result) | |
26 logging.debug(result) | |
27 | |
28 def testToggleNetworkDevice(self): | 15 def testToggleNetworkDevice(self): |
29 """Sanity check to make sure wifi can be disabled and reenabled.""" | 16 """Sanity check to make sure wifi can be disabled and reenabled.""" |
30 self.ToggleNetworkDevice('wifi', False) | 17 self.ToggleNetworkDevice('wifi', False) |
31 self.assertFalse(self.GetNetworkInfo()['wifi_enabled'], | 18 self.assertFalse(self.GetNetworkInfo()['wifi_enabled'], |
32 'Disabled wifi but it is still enabled.') | 19 'Disabled wifi but it is still enabled.') |
33 self.assertFalse('wifi_networks' in self.GetNetworkInfo(), 'GetNetworkInfo ' | 20 self.assertFalse('wifi_networks' in self.GetNetworkInfo(), 'GetNetworkInfo ' |
34 'returned a wifi_networks dict, but wifi is disabled.') | 21 'returned a wifi_networks dict, but wifi is disabled.') |
35 self.ToggleNetworkDevice("wifi", True) | 22 self.ToggleNetworkDevice("wifi", True) |
36 self.assertTrue(self.GetNetworkInfo()['wifi_enabled'], | 23 self.assertTrue(self.GetNetworkInfo()['wifi_enabled'], |
37 'Enabled wifi but it is still disabled.') | 24 'Enabled wifi but it is still disabled.') |
(...skipping 18 matching lines...) Expand all Loading... |
56 self.ForgetAllRememberedNetworks() | 43 self.ForgetAllRememberedNetworks() |
57 # This call should have no problems regardless of whether or not | 44 # This call should have no problems regardless of whether or not |
58 # the network exists. | 45 # the network exists. |
59 self.ForgetWifiNetwork('') | 46 self.ForgetWifiNetwork('') |
60 self.assertFalse(self.GetNetworkInfo()['remembered_wifi'], 'All ' | 47 self.assertFalse(self.GetNetworkInfo()['remembered_wifi'], 'All ' |
61 'remembered wifi networks should have been removed') | 48 'remembered wifi networks should have been removed') |
62 | 49 |
63 | 50 |
64 if __name__ == '__main__': | 51 if __name__ == '__main__': |
65 pyauto_functional.Main() | 52 pyauto_functional.Main() |
OLD | NEW |