| 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 | 4 |
| 5 """Multi tab memory test. | 5 """Multi tab memory test. |
| 6 | 6 |
| 7 This test is a multi tab test, but we're interested in measurements for | 7 This test is a multi tab test, but we're interested in measurements for |
| 8 the entire test rather than each single page. | 8 the entire test rather than each single page. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 def DidStartBrowser(self, browser): | 36 def DidStartBrowser(self, browser): |
| 37 self._memory_metric = memory.MemoryMetric(browser) | 37 self._memory_metric = memory.MemoryMetric(browser) |
| 38 | 38 |
| 39 def CustomizeBrowserOptions(self, options): | 39 def CustomizeBrowserOptions(self, options): |
| 40 memory.MemoryMetric.CustomizeBrowserOptions(options) | 40 memory.MemoryMetric.CustomizeBrowserOptions(options) |
| 41 # Since this is a memory benchmark, we want to sample memory histograms at | 41 # Since this is a memory benchmark, we want to sample memory histograms at |
| 42 # a high frequency. | 42 # a high frequency. |
| 43 options.AppendExtraBrowserArgs('--memory-metrics') | 43 options.AppendExtraBrowserArgs('--memory-metrics') |
| 44 | 44 |
| 45 def TabForPage(self, page, tab): | 45 def TabForPage(self, page, browser): |
| 46 return tab.browser.tabs.New() | 46 return browser.tabs.New() |
| 47 | 47 |
| 48 def DidNavigateToPage(self, page, tab): | 48 def DidNavigateToPage(self, page, tab): |
| 49 # Start measurement on the first tab. | 49 # Start measurement on the first tab. |
| 50 if not self._first_tab: | 50 if not self._first_tab: |
| 51 self._memory_metric.Start(page, tab) | 51 self._memory_metric.Start(page, tab) |
| 52 self._first_tab = tab | 52 self._first_tab = tab |
| 53 | 53 |
| 54 def MeasurePage(self, page, tab, results): | 54 def MeasurePage(self, page, tab, results): |
| 55 # Finalize measurement on the last tab. | 55 # Finalize measurement on the last tab. |
| 56 if len(tab.browser.tabs) == len(page.page_set.pages): | 56 if len(tab.browser.tabs) == len(page.page_set.pages): |
| 57 self._memory_metric.Stop(page, self._first_tab) | 57 self._memory_metric.Stop(page, self._first_tab) |
| 58 self._memory_metric.AddResults(self._first_tab, results) | 58 self._memory_metric.AddResults(self._first_tab, results) |
| 59 | 59 |
| 60 def DidRunTest(self, tab, results): | 60 def DidRunTest(self, browser, results): |
| 61 self._memory_metric.AddSummaryResults(results) | 61 self._memory_metric.AddSummaryResults(results) |
| OLD | NEW |