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

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

Issue 1888343003: Clovis: contentful paint upgrades. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-rename
Patch Set: rebase Created 4 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/android/loading/user_satisfied_lens.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/user_satisfied_lens_unittest.py
diff --git a/tools/android/loading/user_satisfied_lens_unittest.py b/tools/android/loading/user_satisfied_lens_unittest.py
index c7cdb10257ec1e42bfaa271b24571f3830e5d907..c603bbe5ce042188ca1d3814e7492be9065668bf 100644
--- a/tools/android/loading/user_satisfied_lens_unittest.py
+++ b/tools/android/loading/user_satisfied_lens_unittest.py
@@ -32,51 +32,65 @@ class UserSatisfiedLensTestCase(unittest.TestCase):
return rq
def testFirstContentfulPaintLens(self):
+ MAINFRAME = 1
+ SUBFRAME = 2
loading_trace = test_utils.LoadingTraceFromEvents(
[self._RequestAt(1), self._RequestAt(10), self._RequestAt(20)],
trace_events=[{'ts': 0, 'ph': 'I',
'cat': 'blink.some_other_user_timing',
'name': 'firstContentfulPaint'},
- {'ts': 9 * self.MILLI_TO_MICRO, 'ph': 'I',
+ {'ts': 30 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
'name': 'firstDiscontentPaint'},
- {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I',
+ {'ts': 5 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
- 'name': 'firstContentfulPaint'},
- {'ts': 22 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'name': 'firstContentfulPaint',
+ 'args': {'frame': SUBFRAME} },
+ {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
- 'name': 'firstContentfulPaint'}])
+ 'name': 'firstContentfulPaint',
+ 'args': {'frame': MAINFRAME}}])
+ loading_trace.tracing_track.SetMainFrameID(MAINFRAME)
lens = user_satisfied_lens.FirstContentfulPaintLens(loading_trace)
- self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequests())
+ self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds())
self.assertEqual(1, lens.PostloadTimeMsec())
def testCantGetNoSatisfaction(self):
+ MAINFRAME = 1
loading_trace = test_utils.LoadingTraceFromEvents(
[self._RequestAt(1), self._RequestAt(10), self._RequestAt(20)],
trace_events=[{'ts': 0, 'ph': 'I',
'cat': 'not_my_cat',
- 'name': 'someEvent'}])
+ 'name': 'someEvent',
+ 'args': {'frame': MAINFRAME}}])
+ loading_trace.tracing_track.SetMainFrameID(MAINFRAME)
lens = user_satisfied_lens.FirstContentfulPaintLens(loading_trace)
- self.assertEqual(set(['0.1', '0.2', '0.3']), lens.CriticalRequests())
+ self.assertEqual(set(['0.1', '0.2', '0.3']), lens.CriticalRequestIds())
self.assertEqual(float('inf'), lens.PostloadTimeMsec())
def testFirstTextPaintLens(self):
+ MAINFRAME = 1
+ SUBFRAME = 2
loading_trace = test_utils.LoadingTraceFromEvents(
[self._RequestAt(1), self._RequestAt(10), self._RequestAt(20)],
trace_events=[{'ts': 0, 'ph': 'I',
'cat': 'blink.some_other_user_timing',
'name': 'firstPaint'},
- {'ts': 9 * self.MILLI_TO_MICRO, 'ph': 'I',
+ {'ts': 30 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
- 'name': 'firstishPaint'},
- {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'name': 'firstishPaint',
+ 'args': {'frame': MAINFRAME}},
+ {'ts': 3 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
- 'name': 'firstPaint'},
- {'ts': 22 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'name': 'firstPaint',
+ 'args': {'frame': SUBFRAME}},
+ {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I',
'cat': 'blink.user_timing',
- 'name': 'firstPaint'}])
+ 'name': 'firstPaint',
+ 'args': {'frame': MAINFRAME}}])
+ loading_trace.tracing_track.SetMainFrameID(MAINFRAME)
lens = user_satisfied_lens.FirstTextPaintLens(loading_trace)
- self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequests())
+ self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds())
self.assertEqual(1, lens.PostloadTimeMsec())
def testFirstSignificantPaintLens(self):
@@ -112,9 +126,37 @@ class UserSatisfiedLensTestCase(unittest.TestCase):
'LayoutObjectsThatHadNeverHadLayout': 10
} } } ])
lens = user_satisfied_lens.FirstSignificantPaintLens(loading_trace)
- self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequests())
+ self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds())
self.assertEqual(7, lens.PostloadTimeMsec())
+ def testRequestFingerprintLens(self):
+ MAINFRAME = 1
+ SUBFRAME = 2
+ loading_trace = test_utils.LoadingTraceFromEvents(
+ [self._RequestAt(1), self._RequestAt(10), self._RequestAt(20)],
+ trace_events=[{'ts': 0, 'ph': 'I',
+ 'cat': 'blink.some_other_user_timing',
+ 'name': 'firstContentfulPaint'},
+ {'ts': 30 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'cat': 'blink.user_timing',
+ 'name': 'firstDiscontentPaint'},
+ {'ts': 5 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'cat': 'blink.user_timing',
+ 'name': 'firstContentfulPaint',
+ 'args': {'frame': SUBFRAME} },
+ {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I',
+ 'cat': 'blink.user_timing',
+ 'name': 'firstContentfulPaint',
+ 'args': {'frame': MAINFRAME}}])
+ loading_trace.tracing_track.SetMainFrameID(MAINFRAME)
+ lens = user_satisfied_lens.FirstContentfulPaintLens(loading_trace)
+ self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds())
+ self.assertEqual(1, lens.PostloadTimeMsec())
+ request_lens = user_satisfied_lens.RequestFingerprintLens(
+ loading_trace, lens.CriticalFingerprints())
+ self.assertEqual(set(['0.1', '0.2']), request_lens.CriticalRequestIds())
+ self.assertEqual(0, request_lens.PostloadTimeMsec())
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/android/loading/user_satisfied_lens.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698