146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)# Copyright 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PossibleBrowser(object): 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) """A browser that can be controlled. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Call Create() to launch the browser and begin manipulating it.. 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) """ 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch def __init__(self, browser_type, target_os, finder_options, 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch supports_tab_control): 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) self._browser_type = browser_type 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) self._target_os = target_os 17424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) self._finder_options = finder_options 18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch self._supports_tab_control = supports_tab_control 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) self._platform = None 205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) self._platform_backend = None 211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._archive_path = None 221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._append_to_existing_wpr = False 231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._make_javascript_deterministic = True 241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._credentials_path = None 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) def __repr__(self): 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return 'PossibleBrowser(browser_type=%s)' % self.browser_type 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) @property 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) def browser_type(self): 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return self._browser_type 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @property 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) def target_os(self): 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) """Target OS, the browser will run on.""" 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return self._target_os 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) @property 39424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) def finder_options(self): 40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) return self._finder_options 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) @property 43116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch def supports_tab_control(self): 44116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return self._supports_tab_control 45116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 46116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch @property 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) def platform(self): 485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) self._InitPlatformIfNeeded() 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return self._platform 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) def _InitPlatformIfNeeded(self): 525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) raise NotImplementedError() 535f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) def Create(self): 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) raise NotImplementedError() 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 57424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) def SupportsOptions(self, finder_options): 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) """Tests for extension support.""" 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) raise NotImplementedError() 601e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 6103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) def IsRemote(self): 6203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return False 6303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 6403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) def RunRemote(self): 6503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) pass 6603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 6703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) def UpdateExecutableIfNeeded(self): 6803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) pass 6903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 701e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) def last_modification_time(self): 711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return -1 721320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci def SetReplayArchivePath(self, archive_path, append_to_existing_wpr, 741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci make_javascript_deterministic): 751320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._archive_path = archive_path 761320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._append_to_existing_wpr = append_to_existing_wpr 771320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._make_javascript_deterministic = make_javascript_deterministic 781320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci def SetCredentialsPath(self, credentials_path): 801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci self._credentials_path = credentials_path 81