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 os | 5 import os |
6 | 6 |
7 import common_util | 7 import common_util |
8 import emulation | 8 import emulation |
9 import sandwich_runner | 9 import sandwich_runner |
10 import task_manager | 10 import task_manager |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 | 29 |
30 def FilterOutDataAndIncompleteRequests(requests): | 30 def FilterOutDataAndIncompleteRequests(requests): |
31 for request in filter(lambda r: not r.IsDataRequest(), requests): | 31 for request in filter(lambda r: not r.IsDataRequest(), requests): |
32 # The protocol is only known once the response has been received. But the | 32 # The protocol is only known once the response has been received. But the |
33 # trace recording might have been stopped with still some JavaScript | 33 # trace recording might have been stopped with still some JavaScript |
34 # originated requests that have not received any responses yet. | 34 # originated requests that have not received any responses yet. |
35 if request.protocol is None: | 35 if request.protocol is None: |
36 assert not request.HasReceivedResponse() | 36 assert not request.HasReceivedResponse() |
37 continue | 37 continue |
| 38 if request.protocol in {'about'}: |
| 39 continue |
38 if request.protocol not in {'http/0.9', 'http/1.0', 'http/1.1'}: | 40 if request.protocol not in {'http/0.9', 'http/1.0', 'http/1.1'}: |
39 raise RuntimeError('Unknown request protocol {}'.format(request.protocol)) | 41 raise RuntimeError('Unknown request protocol {}'.format(request.protocol)) |
40 yield request | 42 yield request |
41 | 43 |
42 | 44 |
43 class RequestOutcome: | 45 class RequestOutcome: |
44 All, ServedFromCache, NotServedFromCache, Post = range(4) | 46 All, ServedFromCache, NotServedFromCache, Post = range(4) |
45 | 47 |
46 | 48 |
47 def ListUrlRequests(trace, request_kind): | 49 def ListUrlRequests(trace, request_kind): |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 runner = self.CreateSandwichRunner() | 144 runner = self.CreateSandwichRunner() |
143 runner.wpr_archive_path = BuildOriginalWpr.path | 145 runner.wpr_archive_path = BuildOriginalWpr.path |
144 runner.wpr_record = True | 146 runner.wpr_record = True |
145 runner.output_dir = BuildOriginalWpr.run_path | 147 runner.output_dir = BuildOriginalWpr.run_path |
146 runner.Run() | 148 runner.Run() |
147 BuildOriginalWpr.run_path = BuildOriginalWpr.path[:-4] + '-run' | 149 BuildOriginalWpr.run_path = BuildOriginalWpr.path[:-4] + '-run' |
148 | 150 |
149 self.original_wpr_task = BuildOriginalWpr | 151 self.original_wpr_task = BuildOriginalWpr |
150 self.original_wpr_recording_trace_path = os.path.join( | 152 self.original_wpr_recording_trace_path = os.path.join( |
151 BuildOriginalWpr.run_path, '0', sandwich_runner.TRACE_FILENAME) | 153 BuildOriginalWpr.run_path, '0', sandwich_runner.TRACE_FILENAME) |
OLD | NEW |