| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 tabIds[details.sourceTabId] = nextTabId++; | 103 tabIds[details.sourceTabId] = nextTabId++; |
| 104 } | 104 } |
| 105 details.sourceTabId = tabIds[details.sourceTabId]; | 105 details.sourceTabId = tabIds[details.sourceTabId]; |
| 106 } | 106 } |
| 107 if ('replacedTabId' in details) { | 107 if ('replacedTabId' in details) { |
| 108 if (tabIds[details.replacedTabId] === undefined) { | 108 if (tabIds[details.replacedTabId] === undefined) { |
| 109 tabIds[details.replacedTabId] = nextTabId++; | 109 tabIds[details.replacedTabId] = nextTabId++; |
| 110 } | 110 } |
| 111 details.replacedTabId = tabIds[details.replacedTabId]; | 111 details.replacedTabId = tabIds[details.replacedTabId]; |
| 112 } | 112 } |
| 113 // Don't bother testing those before we don't correctly dispatch events for |
| 114 // cross process navigations. |
| 115 if ('processId' in details) { |
| 116 delete details.processId; |
| 117 } |
| 118 if ('sourceProcessId' in details) { |
| 119 delete details.sourceProcessId; |
| 120 } |
| 113 | 121 |
| 114 // find |details| in expectedEventData | 122 // find |details| in expectedEventData |
| 115 var found = false; | 123 var found = false; |
| 116 var label = undefined; | 124 var label = undefined; |
| 117 expectedEventData.forEach(function (exp) { | 125 expectedEventData.forEach(function (exp) { |
| 118 if (deepEq(exp.event, name) && deepEq(exp.details, details)) { | 126 if (deepEq(exp.event, name) && deepEq(exp.details, details)) { |
| 119 if (!found) { | 127 if (!found) { |
| 120 found = true; | 128 found = true; |
| 121 label = exp.label; | 129 label = exp.label; |
| 122 exp.event = undefined; | 130 exp.event = undefined; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 iframe + "onBeforeNavigate", | 196 iframe + "onBeforeNavigate", |
| 189 main_frame + "onDOMContentLoaded", | 197 main_frame + "onDOMContentLoaded", |
| 190 iframe + "onCompleted", | 198 iframe + "onCompleted", |
| 191 main_frame + "onCompleted" ]; | 199 main_frame + "onCompleted" ]; |
| 192 } | 200 } |
| 193 | 201 |
| 194 // Returns the constraint expressing that a frame was loaded by another. | 202 // Returns the constraint expressing that a frame was loaded by another. |
| 195 function isLoadedBy(target, source) { | 203 function isLoadedBy(target, source) { |
| 196 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; | 204 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; |
| 197 } | 205 } |
| OLD | NEW |