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

Unified Diff: tools/telemetry/telemetry/unittest/simple_mock.py

Issue 240893004: Mock timer for Telemetry unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hide time.sleep and time.time Created 6 years, 8 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/page/actions/wait_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/unittest/simple_mock.py
diff --git a/tools/telemetry/telemetry/unittest/simple_mock.py b/tools/telemetry/telemetry/unittest/simple_mock.py
index e468460f23718706138498d1affa9784ae4af838..b54dcac7231ef6337be6861d6bfc5b7f5c77441e 100644
--- a/tools/telemetry/telemetry/unittest/simple_mock.py
+++ b/tools/telemetry/telemetry/unittest/simple_mock.py
@@ -93,3 +93,14 @@ class MockObject(object):
return expected_call.return_value
handler.is_hook = True
setattr(self, func_name, handler)
+
+
+class MockTimer(object):
+ def __init__(self):
+ self._elapsed_time = 0
+
+ def Sleep(self, time):
+ self._elapsed_time += time
+
+ def GetTime(self):
+ return self._elapsed_time
« no previous file with comments | « tools/telemetry/telemetry/page/actions/wait_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698