OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import sys | 4 import sys |
5 | 5 |
6 from measurements import smoothness | 6 from measurements import smoothness |
7 from telemetry.core import wpr_modes | 7 from telemetry.core import wpr_modes |
8 from telemetry.page import page | 8 from telemetry.page import page |
9 from telemetry.page import page_measurement_unittest_base | 9 from telemetry.page import page_measurement_unittest_base |
10 from telemetry.unittest import options_for_unittests | 10 from telemetry.unittest import options_for_unittests |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 Runs smoothness measurement on a simple page and verifies | 39 Runs smoothness measurement on a simple page and verifies |
40 that all metrics were added to the results. The test is purely functional, | 40 that all metrics were added to the results. The test is purely functional, |
41 i.e. it only checks if the metrics are present and non-zero. | 41 i.e. it only checks if the metrics are present and non-zero. |
42 """ | 42 """ |
43 def testSyntheticDelayConfiguration(self): | 43 def testSyntheticDelayConfiguration(self): |
44 test_page = page.Page('http://dummy', None) | 44 test_page = page.Page('http://dummy', None) |
45 test_page.synthetic_delays = { | 45 test_page.synthetic_delays = { |
46 'cc.BeginMainFrame': { 'target_duration': 0.012 }, | 46 'cc.BeginMainFrame': { 'target_duration': 0.012 }, |
47 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' }, | 47 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' }, |
48 'gpu.SwapBuffers': { 'target_duration': 0.012 } | 48 'gpu.PresentingFrame': { 'target_duration': 0.012 } |
49 } | 49 } |
50 | 50 |
51 tab = FakeTab() | 51 tab = FakeTab() |
52 measurement = smoothness.Smoothness() | 52 measurement = smoothness.Smoothness() |
53 measurement.WillRunActions(test_page, tab) | 53 measurement.WillRunActions(test_page, tab) |
54 | 54 |
55 expected_category_filter = [ | 55 expected_category_filter = [ |
56 'DELAY(cc.BeginMainFrame;0.012000;static)', | 56 'DELAY(cc.BeginMainFrame;0.012000;static)', |
57 'DELAY(cc.DrawAndSwap;0.012000;alternating)', | 57 'DELAY(cc.DrawAndSwap;0.012000;alternating)', |
58 'DELAY(gpu.SwapBuffers;0.012000;static)', | 58 'DELAY(gpu.PresentingFrame;0.012000;static)', |
59 'benchmark', | 59 'benchmark', |
60 'webkit.console' | 60 'webkit.console' |
61 ] | 61 ] |
62 actual_category_filter = tab.browser.category_filter.split(',') | 62 actual_category_filter = tab.browser.category_filter.split(',') |
63 actual_category_filter.sort() | 63 actual_category_filter.sort() |
64 if expected_category_filter != actual_category_filter: | 64 if expected_category_filter != actual_category_filter: |
65 sys.stderr.write("Expected category filter: %s\n" % | 65 sys.stderr.write("Expected category filter: %s\n" % |
66 repr(expected_category_filter)) | 66 repr(expected_category_filter)) |
67 sys.stderr.write("Actual category filter filter: %s\n" % | 67 sys.stderr.write("Actual category filter filter: %s\n" % |
68 repr(actual_category_filter)) | 68 repr(actual_category_filter)) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 mean_touch_scroll_latency = results.FindAllPageSpecificValuesNamed( | 104 mean_touch_scroll_latency = results.FindAllPageSpecificValuesNamed( |
105 'mean_touch_scroll_latency') | 105 'mean_touch_scroll_latency') |
106 if mean_touch_scroll_latency: | 106 if mean_touch_scroll_latency: |
107 self.assertEquals(len(mean_touch_scroll_latency), 1) | 107 self.assertEquals(len(mean_touch_scroll_latency), 1) |
108 self.assertGreater( | 108 self.assertGreater( |
109 mean_touch_scroll_latency[0].GetRepresentativeNumber(), 0) | 109 mean_touch_scroll_latency[0].GetRepresentativeNumber(), 0) |
110 | 110 |
111 def testCleanUpTrace(self): | 111 def testCleanUpTrace(self): |
112 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) | 112 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) |
OLD | NEW |