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

Unified Diff: tools/android/loading/metrics_unittest.py

Issue 2021093002: clovis: Report the number and cost of DNS requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « tools/android/loading/metrics.py ('k') | tools/android/loading/report.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/metrics_unittest.py
diff --git a/tools/android/loading/metrics_unittest.py b/tools/android/loading/metrics_unittest.py
index 56153bf2050ace135f22e8a4dffbe8ded87548db..236b48aa792e7b658617aca94be0f1c036fdc199 100644
--- a/tools/android/loading/metrics_unittest.py
+++ b/tools/android/loading/metrics_unittest.py
@@ -72,6 +72,18 @@ class MetricsTestCase(unittest.TestCase):
self.assertEqual(self._BODY_SIZE + self._RESPONSE_HEADERS_SIZE,
downloaded)
+ def testDnsRequestsAndCost(self):
+ trace = self._MakeTrace()
+ (count, cost) = metrics.DnsRequestsAndCost(trace)
+ self.assertEqual(0, count)
+ self.assertEqual(0, cost)
+ r = trace.request_track.GetEvents()[0]
+ r.timing.dns_end = 12
+ r.timing.dns_start = 4
+ (count, cost) = metrics.DnsRequestsAndCost(trace)
+ self.assertEqual(1, count)
+ self.assertEqual(8, cost)
+
@classmethod
def _MakeTrace(cls):
request = request_track.Request.FromJsonDict(copy.deepcopy(cls._REQUEST))
« no previous file with comments | « tools/android/loading/metrics.py ('k') | tools/android/loading/report.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698