| OLD | NEW |
| 1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 The Chromium 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 import logging as real_logging | 4 import logging as real_logging |
| 5 import os | 5 import os |
| 6 | 6 |
| 7 from telemetry.core import discover | 7 from telemetry.core import discover |
| 8 from telemetry.core import local_server |
| 8 from telemetry.core import network_controller | 9 from telemetry.core import network_controller |
| 9 from telemetry.core import tracing_controller | 10 from telemetry.core import tracing_controller |
| 10 from telemetry.core import util | 11 from telemetry.core import util |
| 11 from telemetry.internal.platform import platform_backend as platform_backend_mod
ule | 12 from telemetry.internal.platform import platform_backend as platform_backend_mod
ule |
| 12 | 13 |
| 13 | 14 |
| 14 _host_platform = None | 15 _host_platform = None |
| 15 # Remote platform is a dictionary from device ids to remote platform instances. | 16 # Remote platform is a dictionary from device ids to remote platform instances. |
| 16 _remote_platforms = {} | 17 _remote_platforms = {} |
| 17 | 18 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 API, so check with IsFooBar() for availability. | 73 API, so check with IsFooBar() for availability. |
| 73 """ | 74 """ |
| 74 def __init__(self, platform_backend): | 75 def __init__(self, platform_backend): |
| 75 self._platform_backend = platform_backend | 76 self._platform_backend = platform_backend |
| 76 self._platform_backend.InitPlatformBackend() | 77 self._platform_backend.InitPlatformBackend() |
| 77 self._platform_backend.SetPlatform(self) | 78 self._platform_backend.SetPlatform(self) |
| 78 self._network_controller = network_controller.NetworkController( | 79 self._network_controller = network_controller.NetworkController( |
| 79 self._platform_backend.network_controller_backend) | 80 self._platform_backend.network_controller_backend) |
| 80 self._tracing_controller = tracing_controller.TracingController( | 81 self._tracing_controller = tracing_controller.TracingController( |
| 81 self._platform_backend.tracing_controller_backend) | 82 self._platform_backend.tracing_controller_backend) |
| 83 self._local_server_controller = local_server.LocalServerController( |
| 84 self._platform_backend) |
| 82 | 85 |
| 83 @property | 86 @property |
| 84 def is_host_platform(self): | 87 def is_host_platform(self): |
| 85 return self == GetHostPlatform() | 88 return self == GetHostPlatform() |
| 86 | 89 |
| 87 @property | 90 @property |
| 88 def network_controller(self): | 91 def network_controller(self): |
| 89 """Control network settings and servers to simulate the Web.""" | 92 """Control network settings and servers to simulate the Web.""" |
| 90 return self._network_controller | 93 return self._network_controller |
| 91 | 94 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 308 |
| 306 Args: | 309 Args: |
| 307 proc: a process object returned from subprocess.Popen. | 310 proc: a process object returned from subprocess.Popen. |
| 308 app_name: on Windows, is the prefix of the application's window | 311 app_name: on Windows, is the prefix of the application's window |
| 309 class name that should be searched for. This helps ensure | 312 class name that should be searched for. This helps ensure |
| 310 that only the application's windows are closed. | 313 that only the application's windows are closed. |
| 311 | 314 |
| 312 Returns True if it is believed the attempt succeeded. | 315 Returns True if it is believed the attempt succeeded. |
| 313 """ | 316 """ |
| 314 return self._platform_backend.CooperativelyShutdown(proc, app_name) | 317 return self._platform_backend.CooperativelyShutdown(proc, app_name) |
| 318 |
| 319 def StartLocalServer(self, server): |
| 320 """Starts a LocalServer and associates it with this platform. |
| 321 |server.Close()| should be called manually to close the started server. |
| 322 """ |
| 323 self._local_server_controller.StartServer(server) |
| OLD | NEW |