OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import dbus, logging, os, shutil, socket, sys, time | 5 import dbus, logging, os, shutil, socket, sys, time |
6 from autotest_lib.client.bin import chromeos_constants, site_cryptohome | 6 from autotest_lib.client.bin import chromeos_constants, site_cryptohome |
7 from autotest_lib.client.bin import site_login, site_utils, test as bin_test | 7 from autotest_lib.client.bin import site_login, site_utils, test as bin_test |
8 from autotest_lib.client.common_lib import error, site_ui | 8 from autotest_lib.client.common_lib import error, site_ui |
9 from autotest_lib.client.common_lib import site_auth_server, site_dns_server | 9 from autotest_lib.client.common_lib import site_auth_server, site_dns_server |
10 from dbus.mainloop.glib import DBusGMainLoop | 10 from dbus.mainloop.glib import DBusGMainLoop |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if servers != None: | 84 if servers != None: |
85 self._dns[path] = ','.join(servers) | 85 self._dns[path] = ','.join(servers) |
86 logging.debug("Cached DNS for " + properties['Type']) | 86 logging.debug("Cached DNS for " + properties['Type']) |
87 ipconfig.SetProperty('NameServers', '127.0.0.1') | 87 ipconfig.SetProperty('NameServers', '127.0.0.1') |
88 logging.debug("Changed DNS for " + properties['Type']) | 88 logging.debug("Changed DNS for " + properties['Type']) |
89 | 89 |
90 site_utils.poll_for_condition( | 90 site_utils.poll_for_condition( |
91 lambda: self.__attempt_resolve('www.google.com', '127.0.0.1'), | 91 lambda: self.__attempt_resolve('www.google.com', '127.0.0.1'), |
92 site_login.TimeoutError('Timed out waiting for DNS changes.'), | 92 site_login.TimeoutError('Timed out waiting for DNS changes.'), |
93 10) | 93 10) |
94 site_login.refresh_login_screen() | |
95 | 94 |
96 | 95 |
97 def revert_dns(self): | 96 def revert_dns(self): |
98 """Clear the custom DNS setting for all devices and force them to use | 97 """Clear the custom DNS setting for all devices and force them to use |
99 DHCP to pull the network's real settings again. | 98 DHCP to pull the network's real settings again. |
100 """ | 99 """ |
101 for device in self._flim.GetObjectList('Device'): | 100 for device in self._flim.GetObjectList('Device'): |
102 properties = device.GetProperties() | 101 properties = device.GetProperties() |
103 logging.debug("Considering " + properties['Type']) | 102 logging.debug("Considering " + properties['Type']) |
104 for path in properties['IPConfigs']: | 103 for path in properties['IPConfigs']: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 try: | 163 try: |
165 site_cryptohome.remove_vault(self.username) | 164 site_cryptohome.remove_vault(self.username) |
166 except site_cryptohome.ChromiumOSError, error: | 165 except site_cryptohome.ChromiumOSError, error: |
167 logging.error(error) | 166 logging.error(error) |
168 # Ensure there's no stale owner state from previous tests. | 167 # Ensure there's no stale owner state from previous tests. |
169 try: | 168 try: |
170 os.unlink(chromeos_constants.OWNER_KEY_FILE) | 169 os.unlink(chromeos_constants.OWNER_KEY_FILE) |
171 os.unlink(chromeos_constants.SIGNED_PREFERENCES_FILE) | 170 os.unlink(chromeos_constants.SIGNED_PREFERENCES_FILE) |
172 except (IOError, OSError) as error: | 171 except (IOError, OSError) as error: |
173 logging.info(error) | 172 logging.info(error) |
| 173 site_login.refresh_login_screen() |
174 | 174 |
175 if self.auto_login: | 175 if self.auto_login: |
176 self.login(self.username, self.password) | 176 self.login(self.username, self.password) |
177 | 177 |
178 | 178 |
179 def __canonicalize(self, credential): | 179 def __canonicalize(self, credential): |
180 """Perform basic canonicalization of |email_address| | 180 """Perform basic canonicalization of |email_address| |
181 | 181 |
182 Perform basic canonicalization of |email_address|, taking | 182 Perform basic canonicalization of |email_address|, taking |
183 into account that gmail does not consider '.' or caps inside a | 183 into account that gmail does not consider '.' or caps inside a |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 logging.error(error) | 299 logging.error(error) |
300 | 300 |
301 self.stop_authserver() | 301 self.stop_authserver() |
302 | 302 |
303 | 303 |
304 def get_auth_endpoint_misses(self): | 304 def get_auth_endpoint_misses(self): |
305 if hasattr(self, '_authServer'): | 305 if hasattr(self, '_authServer'): |
306 return self._authServer.get_endpoint_misses() | 306 return self._authServer.get_endpoint_misses() |
307 else: | 307 else: |
308 return {} | 308 return {} |
OLD | NEW |