OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import argparse | 5 import argparse |
6 import json | 6 import json |
7 import os | 7 import os |
8 import shlex | 8 import shlex |
9 import sys | 9 import sys |
10 import time | 10 import time |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 def ClearCache(self): | 144 def ClearCache(self): |
145 """ | 145 """ |
146 Clears the browser cache. Important note: ChromeDriver automatically starts | 146 Clears the browser cache. Important note: ChromeDriver automatically starts |
147 a clean copy of Chrome on every instantiation. | 147 a clean copy of Chrome on every instantiation. |
148 """ | 148 """ |
149 self.ExecuteJavascript('if(window.chrome && chrome.benchmarking && ' | 149 self.ExecuteJavascript('if(window.chrome && chrome.benchmarking && ' |
150 'chrome.benchmarking.clearCache){chrome.benchmarking.clearCache(); ' | 150 'chrome.benchmarking.clearCache){chrome.benchmarking.clearCache(); ' |
151 'chrome.benchmarking.clearPredictorCache();chrome.benchmarking.' | 151 'chrome.benchmarking.clearPredictorCache();chrome.benchmarking.' |
152 'clearHostResolverCache();}') | 152 'clearHostResolverCache();}') |
153 | 153 |
154 # TODO(robertogden) use a smart page instead | |
155 def SetURL(self, url): | 154 def SetURL(self, url): |
156 """ | 155 """ |
157 Sets the URL that the browser will navigate to during the test. | 156 Sets the URL that the browser will navigate to during the test. |
158 """ | 157 """ |
159 self._url = url | 158 self._url = url |
160 | 159 |
161 # TODO(robertogden) add timeout | 160 # TODO(robertogden) add timeout |
162 def LoadPage(self): | 161 def LoadPage(self): |
163 """ | 162 """ |
164 Starts Chromium with any arguments previously given and navigates to the | 163 Starts Chromium with any arguments previously given and navigates to the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 def Fail(self, msg): | 203 def Fail(self, msg): |
205 sys.stderr.write("**************************************\n") | 204 sys.stderr.write("**************************************\n") |
206 sys.stderr.write("**************************************\n") | 205 sys.stderr.write("**************************************\n") |
207 sys.stderr.write("** **\n") | 206 sys.stderr.write("** **\n") |
208 sys.stderr.write("** TEST FAILURE **\n") | 207 sys.stderr.write("** TEST FAILURE **\n") |
209 sys.stderr.write("** **\n") | 208 sys.stderr.write("** **\n") |
210 sys.stderr.write("**************************************\n") | 209 sys.stderr.write("**************************************\n") |
211 sys.stderr.write("**************************************\n") | 210 sys.stderr.write("**************************************\n") |
212 sys.stderr.write(msg, '\n') | 211 sys.stderr.write(msg, '\n') |
213 sys.exit(1) | 212 sys.exit(1) |
OLD | NEW |