| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """The page cycler measurement. | 5 """The page cycler measurement. |
| 6 | 6 |
| 7 This measurement registers a window load handler in which is forces a layout and | 7 This measurement registers a window load handler in which is forces a layout and |
| 8 then records the value of performance.now(). This call to now() measures the | 8 then records the value of performance.now(). This call to now() measures the |
| 9 time from navigationStart (immediately after the previous page's beforeunload | 9 time from navigationStart (immediately after the previous page's beforeunload |
| 10 event) until after the layout in the page's load event. In addition, two garbage | 10 event) until after the layout in the page's load event. In addition, two garbage |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 for h in MEMORY_HISTOGRAMS] | 55 for h in MEMORY_HISTOGRAMS] |
| 56 | 56 |
| 57 def WillNavigateToPage(self, page, tab): | 57 def WillNavigateToPage(self, page, tab): |
| 58 page.script_to_evaluate_on_commit = self.page_cycler_js | 58 page.script_to_evaluate_on_commit = self.page_cycler_js |
| 59 | 59 |
| 60 def DidNavigateToPage(self, page, tab): | 60 def DidNavigateToPage(self, page, tab): |
| 61 for h in self.histograms: | 61 for h in self.histograms: |
| 62 h.Start(page, tab) | 62 h.Start(page, tab) |
| 63 | 63 |
| 64 def CustomizeBrowserOptions(self, options): | 64 def CustomizeBrowserOptions(self, options): |
| 65 options.AppendExtraBrowserArg('--enable-stats-collection-bindings') | 65 options.AppendExtraBrowserArg('--dom-automation') |
| 66 options.AppendExtraBrowserArg('--js-flags=--expose_gc') | 66 options.AppendExtraBrowserArg('--js-flags=--expose_gc') |
| 67 options.AppendExtraBrowserArg('--no-sandbox') | 67 options.AppendExtraBrowserArg('--no-sandbox') |
| 68 | 68 |
| 69 # Temporarily disable typical_25 page set on mac. | 69 # Temporarily disable typical_25 page set on mac. |
| 70 if sys.platform == 'darwin' and sys.argv[-1].endswith('/typical_25.json'): | 70 if sys.platform == 'darwin' and sys.argv[-1].endswith('/typical_25.json'): |
| 71 print 'typical_25 is currently disabled on mac. Skipping test.' | 71 print 'typical_25 is currently disabled on mac. Skipping test.' |
| 72 sys.exit(0) | 72 sys.exit(0) |
| 73 | 73 |
| 74 def MeasureMemory(self, tab, results): | 74 def MeasureMemory(self, tab, results): |
| 75 memory = tab.browser.memory_stats | 75 memory = tab.browser.memory_stats |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 for h in self.histograms: | 147 for h in self.histograms: |
| 148 h.GetValue(page, tab, results) | 148 h.GetValue(page, tab, results) |
| 149 | 149 |
| 150 results.Add('page_load_time', 'ms', | 150 results.Add('page_load_time', 'ms', |
| 151 int(float(tab.EvaluateJavaScript('__pc_load_time'))), | 151 int(float(tab.EvaluateJavaScript('__pc_load_time'))), |
| 152 chart_name='times') | 152 chart_name='times') |
| 153 | 153 |
| 154 def DidRunPageSet(self, tab, results): | 154 def DidRunPageSet(self, tab, results): |
| 155 self.MeasureMemory(tab, results) | 155 self.MeasureMemory(tab, results) |
| 156 self.MeasureIO(tab, results) | 156 self.MeasureIO(tab, results) |
| OLD | NEW |