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

Unified Diff: tools/telemetry/telemetry/core/tab_unittest.py

Issue 176863005: Add is_tracing to browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « tools/telemetry/telemetry/core/tab.py ('k') | tools/telemetry/telemetry/core/web_contents.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/tab_unittest.py
diff --git a/tools/telemetry/telemetry/core/tab_unittest.py b/tools/telemetry/telemetry/core/tab_unittest.py
index 735205065c1a5a60f9cc0ce66a4cfc4adf54df40..ede2520e19bb560261b5a70c0b2bcf756f8501dc 100644
--- a/tools/telemetry/telemetry/core/tab_unittest.py
+++ b/tools/telemetry/telemetry/core/tab_unittest.py
@@ -13,6 +13,26 @@ def _IsDocumentVisible(tab):
return not tab.EvaluateJavaScript('document.hidden || document.webkitHidden')
+class FakePlatform(object):
+ def __init__(self):
+ self._is_video_capture_running = False
+
+ #pylint: disable=W0613
+ def StartVideoCapture(self, min_bitrate_mbps):
+ self._is_video_capture_running = True
+
+ def StopVideoCapture(self):
+ self._is_video_capture_running = False
+ return []
+
+ def SetFullPerformanceModeEnabled(self, enabled):
+ pass
+
+ @property
+ def is_video_capture_running(self):
+ return self._is_video_capture_running
+
+
class TabTest(tab_test_case.TabTestCase):
def testNavigateAndWaitToForCompleteState(self):
self._browser.SetHTTPServerDirectories(util.GetUnittestDataDir())
@@ -46,6 +66,27 @@ class TabTest(tab_test_case.TabTestCase):
util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5)
self.assertFalse(_IsDocumentVisible(new_tab))
+ def testIsTimelineRecordingRunningTab(self):
+ self.assertFalse(self._tab.is_timeline_recording_running)
+ self._tab.StartTimelineRecording()
+ self.assertTrue(self._tab.is_timeline_recording_running)
+ self._tab.StopTimelineRecording()
+ self.assertFalse(self._tab.is_timeline_recording_running)
+
+ #pylint: disable=W0212
+ def testIsVideoCaptureRunning(self):
+ original_platform = self._tab.browser._platform
+ self._tab.browser._platform = FakePlatform()
+ self.assertFalse(self._tab.is_video_capture_running)
+ self._tab.StartVideoCapture(min_bitrate_mbps=2)
+ self.assertTrue(self._tab.is_video_capture_running)
+ try:
+ self._tab.StopVideoCapture().next()
+ except Exception:
+ pass
+ self.assertFalse(self._tab.is_video_capture_running)
+ self._tab.browser._platform = original_platform
+
class GpuTabTest(tab_test_case.TabTestCase):
def setUp(self):
« no previous file with comments | « tools/telemetry/telemetry/core/tab.py ('k') | tools/telemetry/telemetry/core/web_contents.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698