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

Unified Diff: telemetry/telemetry/internal/browser/tab_unittest.py

Issue 2887963002: Revert of [Telemetry][CodeHealth] Make unittests with fake platforms use fakes.FakePlatform (Closed)
Patch Set: 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 | « no previous file | telemetry/telemetry/internal/platform/tracing_agent/battor_tracing_agent_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/browser/tab_unittest.py
diff --git a/telemetry/telemetry/internal/browser/tab_unittest.py b/telemetry/telemetry/internal/browser/tab_unittest.py
index 2daeea7ab6ab4c3ea0078e3fed0467da203f4336..9170f8b89c3957163a0c72b09e44cdcc470fe8df 100644
--- a/telemetry/telemetry/internal/browser/tab_unittest.py
+++ b/telemetry/telemetry/internal/browser/tab_unittest.py
@@ -3,11 +3,12 @@
# found in the LICENSE file.
import logging
+import tempfile
import time
from telemetry.core import exceptions
from telemetry import decorators
-from telemetry.testing import fakes
+from telemetry.internal.image_processing import video
from telemetry.testing import tab_test_case
from telemetry.timeline import model
from telemetry.timeline import tracing_config
@@ -19,6 +20,34 @@
def _IsDocumentVisible(tab):
return not tab.EvaluateJavaScript('document.hidden || document.webkitHidden')
+
+
+class FakePlatformBackend(object):
+ def __init__(self):
+ self.platform = FakePlatform()
+
+ def DidStartBrowser(self, _, _2):
+ pass
+
+ def WillCloseBrowser(self, _, _2):
+ pass
+
+
+class FakePlatform(object):
+ def __init__(self):
+ self._is_video_capture_running = False
+
+ #pylint: disable=unused-argument
+ def StartVideoCapture(self, min_bitrate_mbps):
+ 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
class TabTest(tab_test_case.TabTestCase):
@@ -78,7 +107,7 @@
def testIsVideoCaptureRunning(self):
original_platform_backend = self._tab.browser._platform_backend
try:
- self._tab.browser._platform_backend = fakes.FakePlatformBackend()
+ self._tab.browser._platform_backend = FakePlatformBackend()
self.assertFalse(self._tab.is_video_capture_running)
self._tab.StartVideoCapture(min_bitrate_mbps=2)
self.assertTrue(self._tab.is_video_capture_running)
« no previous file with comments | « no previous file | telemetry/telemetry/internal/platform/tracing_agent/battor_tracing_agent_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698