1# Copyright 2015 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""An adapter to remotely access the browser facade on DUT.""" 6 7 8class BrowserFacadeRemoteAdapter(object): 9 """BrowserFacadeRemoteAdapter is an adapter to remotely control DUT browser. 10 11 The Autotest host object representing the remote DUT, passed to this 12 class on initialization, can be accessed from its _client property. 13 14 """ 15 def __init__(self, remote_facade_proxy): 16 """Construct an BrowserFacadeRemoteAdapter. 17 18 @param remote_facade_proxy: RemoteFacadeProxy object. 19 20 """ 21 self._proxy = remote_facade_proxy 22 23 24 @property 25 def _browser_proxy(self): 26 """Gets the proxy to DUT browser facade. 27 28 @return XML RPC proxy to DUT browser facade. 29 30 """ 31 return self._proxy.browser 32 33 34 def new_tab(self, url): 35 """Opens a new tab and loads URL. 36 37 @param url: The URL to load. 38 @return a str, the tab descriptor of the opened tab. 39 40 """ 41 return self._browser_proxy.new_tab(url) 42 43 44 def close_tab(self, tab_descriptor): 45 """Closes a previously opened tab. 46 47 @param tab_descriptor: Indicate which tab to be closed. 48 49 """ 50 self._browser_proxy.close_tab(tab_descriptor) 51