Commit 8bb06f07 authored by rajendrant's avatar rajendrant Committed by Commit Bot

Fix video test by adding delay and use GetBrowserHistogram

It requires some delay for the XHR request to be populated in PLM.
The total pagesize can also be 3-4 KB since favicon.ico could get
included after the delay, so GreaterEqual 3KB was used.

Bug: 961967
Change-Id: Ic23f93e6d276288a8be71684200b705b982e7c4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1607621Reviewed-by: default avatarRobert Ogden <robertogden@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659082}
parent 1507248f
...@@ -95,16 +95,18 @@ class Video(IntegrationTest): ...@@ -95,16 +95,18 @@ class Video(IntegrationTest):
# ofcl should be same as compressed full content length, since no # ofcl should be same as compressed full content length, since no
# compression for XHR. # compression for XHR.
self.assertEqual(ofcl, compressed_full_content_length) self.assertEqual(ofcl, compressed_full_content_length)
# Navigate away to trigger the metrics recording for previous page load. # Wait and navigate away to trigger the metrics recording for previous
# page load.
time.sleep(1)
t.LoadURL('about:blank') t.LoadURL('about:blank')
original_kb_histogram = t.GetHistogram('PageLoad.Clients.' original_kb_histogram = t.GetBrowserHistogram('PageLoad.Clients.'
'DataReductionProxy.Experimental.Bytes.Network.Original2') 'DataReductionProxy.Experimental.Bytes.Network.Original2')
compression_percent_histogram = t.GetHistogram('PageLoad.Clients.' compression_percent_histogram = t.GetBrowserHistogram('PageLoad.Clients.'
'DataReductionProxy.Experimental.Bytes.Network.CompressionRatio2') 'DataReductionProxy.Experimental.Bytes.Network.CompressionRatio2')
self.assertEqual(1, original_kb_histogram['count']) self.assertEqual(1, original_kb_histogram['count'])
self.assertEqual(1, compression_percent_histogram['count']) self.assertEqual(1, compression_percent_histogram['count'])
# Verify the total page size is 3 KB, and compression ratio. # Verify the total page size is 3 KB, and compression ratio.
self.assertEqual(3, original_kb_histogram['sum']) self.assertGreaterEqual(3, original_kb_histogram['sum'])
self.assertEqual(compression_percent_histogram['sum'], self.assertEqual(compression_percent_histogram['sum'],
compressed_full_content_length/ofcl*100) compressed_full_content_length/ofcl*100)
self.assertTrue(saw_range_response, 'No range request was seen in test!') self.assertTrue(saw_range_response, 'No range request was seen in test!')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment