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 var deepEq = chrome.test.checkDeepEq; | 5 var deepEq = chrome.test.checkDeepEq; |
6 var expectedEventData; | 6 var expectedEventData; |
7 var expectedEventOrder; | 7 var expectedEventOrder; |
8 var capturedEventData; | 8 var capturedEventData; |
9 var nextFrameId; | 9 var nextFrameId; |
10 var frameIds; | 10 var frameIds; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 chrome.test.succeed(); | 91 chrome.test.succeed(); |
92 } | 92 } |
93 | 93 |
94 function captureEvent(name, details) { | 94 function captureEvent(name, details) { |
95 if ('url' in details) { | 95 if ('url' in details) { |
96 // Skip about:blank navigations | 96 // Skip about:blank navigations |
97 if (details.url == 'about:blank') { | 97 if (details.url == 'about:blank') { |
98 return; | 98 return; |
99 } | 99 } |
100 // Strip query parameter as it is hard to predict. | 100 // Strip query parameter as it is hard to predict. |
101 details.url = details.url.replace(new RegExp('\\?.*'), ''); | 101 details.url = details.url.replace(new RegExp('\\?[^#]*'), ''); |
102 } | 102 } |
103 // normalize details. | 103 // normalize details. |
104 if ('timeStamp' in details) { | 104 if ('timeStamp' in details) { |
105 details.timeStamp = 0; | 105 details.timeStamp = 0; |
106 } | 106 } |
107 if (('frameId' in details) && (details.frameId != 0)) { | 107 if (('frameId' in details) && (details.frameId != 0)) { |
108 if (frameIds[details.frameId] === undefined) { | 108 if (frameIds[details.frameId] === undefined) { |
109 frameIds[details.frameId] = nextFrameId++; | 109 frameIds[details.frameId] = nextFrameId++; |
110 } | 110 } |
111 details.frameId = frameIds[details.frameId]; | 111 details.frameId = frameIds[details.frameId]; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 iframe + "onBeforeNavigate", | 244 iframe + "onBeforeNavigate", |
245 main_frame + "onDOMContentLoaded", | 245 main_frame + "onDOMContentLoaded", |
246 iframe + "onCompleted", | 246 iframe + "onCompleted", |
247 main_frame + "onCompleted" ]; | 247 main_frame + "onCompleted" ]; |
248 } | 248 } |
249 | 249 |
250 // Returns the constraint expressing that a frame was loaded by another. | 250 // Returns the constraint expressing that a frame was loaded by another. |
251 function isLoadedBy(target, source) { | 251 function isLoadedBy(target, source) { |
252 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; | 252 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; |
253 } | 253 } |
OLD | NEW |