Index: tools/perf/measurements/tab_switching_unittest.py |
diff --git a/tools/perf/measurements/tab_switching_unittest.py b/tools/perf/measurements/tab_switching_unittest.py |
index 79efbb116d3ace14849a694b87153d47a8cfc774..4483bdd3707e9eacf89a955ed9eeb1beade04619 100644 |
--- a/tools/perf/measurements/tab_switching_unittest.py |
+++ b/tools/perf/measurements/tab_switching_unittest.py |
@@ -63,22 +63,9 @@ class TabSwitchingUnittest(page_test_test_case.PageTestTestCase): |
# Mock histogram result to test _IsDone really works. |
expected_histogram = [ |
- # To get first_histogram for last tab (tab_1). |
+ # DidNavigateToPage() calls GetHistogram() once |
'{"count": 0, "buckets": []}', |
- # First _IsDone check for tab_0. Retry. |
vovoy
2017/03/23 09:37:49
_IsDone() check loop is removed in the written tab
|
- '{"count": 0, "buckets": []}', |
- # Second _IsDone check for tab_0. Retry. |
- '{"count": 0, "buckets": []}', |
- # Third _IsDone check for tab_0. Pass. |
- '{"count": 1, "buckets": [{"low": 1, "high": 2, "count": 1}]}', |
- # To get prev_histogram. End of tab_0 loop. |
- '{"count": 1, "buckets": [{"low": 1, "high": 2, "count": 1}]}', |
- # First _IsDone check for tab_1. Retry. |
- '{"count": 1, "buckets": [{"low": 1, "high": 2, "count": 1}]}', |
- # Second _IsDone check for tab_1. Pass. |
- '{"count": 2, "buckets": [{"low": 1, "high": 2, "count": 1},' |
- '{"low": 2, "high": 3, "count": 1}]}', |
- # To get prev_histogram. End of tab_1 loop. |
+ # ValidateAndMeasurePage() calls GetHistogram() once |
'{"count": 2, "buckets": [{"low": 1, "high": 2, "count": 1},' |
'{"low": 2, "high": 3, "count": 1}]}', |
] |
@@ -88,10 +75,13 @@ class TabSwitchingUnittest(page_test_test_case.PageTestTestCase): |
mock.patch('telemetry.value.histogram_util.GetHistogram', |
mock_get_histogram), |
mock.patch('metrics.keychain_metric.KeychainMetric')): |
+ measure.DidNavigateToPage(story_set.stories[0], browser.tabs[-1]) |
measure.ValidateAndMeasurePage(story_set.stories[0], browser.tabs[-1], |
page_test_results.PageTestResults()) |
self.assertEqual(len(expected_histogram), |
len(mock_get_histogram.mock_calls)) |
+ # The last tab is passed to DidNavigateToPage() and |
+ # ValidateAndMeasurePage() |
expected_calls = [mock.call(mock.ANY, mock.ANY, t) for t in |
- [tab_1] + [tab_0] * 4 + [tab_1] * 3] |
+ [browser.tabs[-1]] * 2] |
self.assertEqual(expected_calls, mock_get_histogram.mock_calls) |