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
3# found in the LICENSE file.
4
5
6
7class PossibleBrowser(object):
8  """A browser that can be controlled.
9
10  Call Create() to launch the browser and begin manipulating it..
11  """
12
13  def __init__(self, browser_type, target_os, finder_options,
14               supports_tab_control):
15    self._browser_type = browser_type
16    self._target_os = target_os
17    self._finder_options = finder_options
18    self._supports_tab_control = supports_tab_control
19    self._platform = None
20    self._platform_backend = None
21    self._archive_path = None
22    self._append_to_existing_wpr = False
23    self._make_javascript_deterministic = True
24    self._credentials_path = None
25
26  def __repr__(self):
27    return 'PossibleBrowser(browser_type=%s)' % self.browser_type
28
29  @property
30  def browser_type(self):
31    return self._browser_type
32
33  @property
34  def target_os(self):
35    """Target OS, the browser will run on."""
36    return self._target_os
37
38  @property
39  def finder_options(self):
40    return self._finder_options
41
42  @property
43  def supports_tab_control(self):
44    return self._supports_tab_control
45
46  @property
47  def platform(self):
48    self._InitPlatformIfNeeded()
49    return self._platform
50
51  def _InitPlatformIfNeeded(self):
52    raise NotImplementedError()
53
54  def Create(self):
55    raise NotImplementedError()
56
57  def SupportsOptions(self, finder_options):
58    """Tests for extension support."""
59    raise NotImplementedError()
60
61  def IsRemote(self):
62    return False
63
64  def RunRemote(self):
65    pass
66
67  def UpdateExecutableIfNeeded(self):
68    pass
69
70  def last_modification_time(self):
71    return -1
72
73  def SetReplayArchivePath(self, archive_path, append_to_existing_wpr,
74                           make_javascript_deterministic):
75    self._archive_path = archive_path
76    self._append_to_existing_wpr = append_to_existing_wpr
77    self._make_javascript_deterministic = make_javascript_deterministic
78
79  def SetCredentialsPath(self, credentials_path):
80    self._credentials_path = credentials_path
81