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('--dom-automation') | 65 options.AppendExtraBrowserArg('--enable-stats-collection-bindings') |
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 # Old commandline flags used for reference builds. |
| 70 options.AppendExtraBrowserArg('--dom-automation') |
| 71 |
69 # Temporarily disable typical_25 page set on mac. | 72 # Temporarily disable typical_25 page set on mac. |
70 if sys.platform == 'darwin' and sys.argv[-1].endswith('/typical_25.json'): | 73 if sys.platform == 'darwin' and sys.argv[-1].endswith('/typical_25.json'): |
71 print 'typical_25 is currently disabled on mac. Skipping test.' | 74 print 'typical_25 is currently disabled on mac. Skipping test.' |
72 sys.exit(0) | 75 sys.exit(0) |
73 | 76 |
74 def MeasureMemory(self, tab, results): | 77 def MeasureMemory(self, tab, results): |
75 memory = tab.browser.memory_stats | 78 memory = tab.browser.memory_stats |
76 if not memory['Browser']: | 79 if not memory['Browser']: |
77 return | 80 return |
78 | 81 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 for h in self.histograms: | 150 for h in self.histograms: |
148 h.GetValue(page, tab, results) | 151 h.GetValue(page, tab, results) |
149 | 152 |
150 results.Add('page_load_time', 'ms', | 153 results.Add('page_load_time', 'ms', |
151 int(float(tab.EvaluateJavaScript('__pc_load_time'))), | 154 int(float(tab.EvaluateJavaScript('__pc_load_time'))), |
152 chart_name='times') | 155 chart_name='times') |
153 | 156 |
154 def DidRunPageSet(self, tab, results): | 157 def DidRunPageSet(self, tab, results): |
155 self.MeasureMemory(tab, results) | 158 self.MeasureMemory(tab, results) |
156 self.MeasureIO(tab, results) | 159 self.MeasureIO(tab, results) |
OLD | NEW |