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

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

Issue 2889583003: [Telemetry][CodeHealth] Make unittests with fake platforms use fakes.FakePlatform (Closed)
Patch Set: [Telemetry][CodeHealth] Make unittests with fake platforms use fakes.FakePlatform Created 3 years, 7 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 | « telemetry/telemetry/internal/story_runner_unittest.py ('k') | 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 5cb897a1dbe758876e8317ce07d84bb49269c35a..3a7c425761fa478976013cda4cfacb835623b677 100644
--- a/telemetry/telemetry/testing/fakes/__init__.py
+++ b/telemetry/telemetry/testing/fakes/__init__.py
@@ -10,8 +10,11 @@ underscore are intended to be implementation details, and should not
be subclassed; however, some, like _FakeBrowser, have public APIs that
may need to be called in tests.
"""
+import tempfile
+
from telemetry.internal.backends.chrome_inspector import websocket
from telemetry.internal.browser import browser_options
+from telemetry.internal.image_processing import video
from telemetry.internal.platform import system_info
from telemetry.page import shared_page_state
from telemetry.util import image_util
@@ -22,12 +25,37 @@ from types import ModuleType
# Classes and functions which are intended to be part of the public
# fakes API.
+class FakePlatformBackend(object):
+ def __init__(self):
+ self.platform = FakePlatform()
+
+ def DidStartBrowser(self, browser, browser_backend):
+ del browser, browser_backend # unused
+
+ def WillCloseBrowser(self, browser, browser_backend):
+ del browser, browser_backend # unused
+
+
class FakePlatform(object):
def __init__(self):
self._network_controller = None
self._tracing_controller = None
self._has_battor = False
self._os_name = 'FakeOS'
+ self.device = 'fake_device'
+ self._is_video_capture_running = False
+
+ def StartVideoCapture(self, min_bitrate_mbps):
+ del min_bitrate_mbps # unused
+ self._is_video_capture_running = True
+
+ def StopVideoCapture(self):
+ self._is_video_capture_running = False
+ return video.Video(tempfile.NamedTemporaryFile())
+
+ @property
+ def is_video_capture_running(self):
+ return self._is_video_capture_running
@property
def is_host_platform(self):
@@ -554,4 +582,3 @@ class FakeTimer(object):
self._module.time = self._actual_time
self._module = None
self._actual_time = None
-
« no previous file with comments | « telemetry/telemetry/internal/story_runner_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698