Fix hanging tsproxy process after test execution
BUG=chromium:648359
TEST=After muliple runs test_that <ip> cheets_ContainerSmokeTest there
is no python process on device that consumes 100%.
TEST=test_that <ip> suite:arc-bvt-cq
Change-Id: Iffba8c43f1fdf85778ad9847f3bb1e76cd3562b8
Reviewed-on: https://chromium-review.googlesource.com/387209
Tested-by: Yury Khmel <khmel@google.com>
Trybot-Ready: Yury Khmel <khmel@google.com>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Yury Khmel <khmel@google.com>
diff --git a/client/common_lib/cros/chrome.py b/client/common_lib/cros/chrome.py
index d5ed0b0..cc6401b 100644
--- a/client/common_lib/cros/chrome.py
+++ b/client/common_lib/cros/chrome.py
@@ -165,19 +165,19 @@
for i in range(num_tries):
try:
browser_to_create = browser_finder.FindBrowser(finder_options)
- network_controller = \
+ self.network_controller = \
browser_to_create.platform.network_controller
# TODO(achuith): Remove if condition after catapult:#2584 has
# landed and PFQ has rolled. crbug.com/639730.
- if hasattr(network_controller, 'InitializeIfNeeded'):
- network_controller.InitializeIfNeeded()
+ if hasattr(self.network_controller, 'InitializeIfNeeded'):
+ self.network_controller.InitializeIfNeeded()
self._browser = browser_to_create.Create(finder_options)
if is_arc_available():
if not disable_arc_opt_in:
arc_util.opt_in(self.browser)
arc_util.post_processing_after_browser(self)
break
- except (exceptions.LoginException) as e:
+ except exceptions.LoginException as e:
logging.error('Timed out logging in, tries=%d, error=%s',
i, repr(e))
if i == num_tries-1:
@@ -264,7 +264,7 @@
"""
try:
func()
- except (Error):
+ except Error:
return True
return False
@@ -301,6 +301,13 @@
def close(self):
+ try:
+ if hasattr(self.network_controller, 'Close'):
+ self.network_controller.Close()
+ logging.info('Network controller is closed')
+ except Error as e:
+ logging.error('Failed to close network controller, error=%s', e)
+
"""Closes the browser."""
try:
if is_arc_available():