Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Unified Diff: telemetry/telemetry/testing/fakes/__init__.py

Issue 2148283003: Adding the ability to fake crash the browser in _FakeBrowser (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: Supressing unused variable warnings Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/testing/fakes/__init__.py
diff --git a/telemetry/telemetry/testing/fakes/__init__.py b/telemetry/telemetry/testing/fakes/__init__.py
index 1048d39c8fcbc93a50f43de9180284ea3e52ce70..cf5617368d421082446f0dd131684413320a099b 100644
--- a/telemetry/telemetry/testing/fakes/__init__.py
+++ b/telemetry/telemetry/testing/fakes/__init__.py
@@ -197,6 +197,7 @@ class _FakeBrowser(object):
self._returned_system_info = FakeSystemInfo()
self._platform = platform
self._browser_type = 'release'
+ self._is_crashed = False
@property
def platform(self):
@@ -236,7 +237,7 @@ class _FakeBrowser(object):
return _FakeCredentials()
def Close(self):
- pass
+ self._is_crashed = False
@property
def supports_system_info(self):
@@ -333,7 +334,10 @@ class _FakeTab(object):
def Navigate(self, url, script_to_evaluate_on_commit=None,
timeout=0):
- pass
+ del script_to_evaluate_on_commit, timeout # unused
+ if url == 'chrome://crash':
+ self.browser._is_crashed = True
+ raise Exception
def WaitForDocumentReadyStateToBeInteractiveOrBetter(self, timeout=0):
pass
@@ -380,7 +384,10 @@ class _FakeTabList(object):
return len(self._tabs)
def __getitem__(self, index):
- return self._tabs[index]
+ if self._tabs[index].browser._is_crashed:
+ raise Exception
+ else:
+ return self._tabs[index]
def GetTabById(self, identifier):
"""The identifier of a tab can be accessed with tab.id."""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698