| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // event with label "a" needs to occur before event with label "b". The | 45 // event with label "a" needs to occur before event with label "b". The |
| 46 // relative order of "a" and "d" does not matter. | 46 // relative order of "a" and "d" does not matter. |
| 47 function expect(data, order) { | 47 function expect(data, order) { |
| 48 expectedEventData = data; | 48 expectedEventData = data; |
| 49 capturedEventData = []; | 49 capturedEventData = []; |
| 50 expectedEventOrder = order; | 50 expectedEventOrder = order; |
| 51 nextFrameId = 1; | 51 nextFrameId = 1; |
| 52 frameIds = {}; | 52 frameIds = {}; |
| 53 nextTabId = 0; | 53 nextTabId = 0; |
| 54 tabIds = {}; | 54 tabIds = {}; |
| 55 nextProcessId = 0; | 55 nextProcessId = -1; |
| 56 processIds = {} | 56 processIds = {} |
| 57 initListeners(); | 57 initListeners(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 function checkExpectations() { | 60 function checkExpectations() { |
| 61 if (capturedEventData.length < expectedEventData.length) { | 61 if (capturedEventData.length < expectedEventData.length) { |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 if (capturedEventData.length > expectedEventData.length) { | 64 if (capturedEventData.length > expectedEventData.length) { |
| 65 chrome.test.fail("Recorded too many events. " + | 65 chrome.test.fail("Recorded too many events. " + |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 return [ main_frame + "onCommitted", | 254 return [ main_frame + "onCommitted", |
| 255 iframe + "onBeforeNavigate", | 255 iframe + "onBeforeNavigate", |
| 256 iframe + "onCompleted", | 256 iframe + "onCompleted", |
| 257 main_frame + "onCompleted" ]; | 257 main_frame + "onCompleted" ]; |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Returns the constraint expressing that a frame was loaded by another. | 260 // Returns the constraint expressing that a frame was loaded by another. |
| 261 function isLoadedBy(target, source) { | 261 function isLoadedBy(target, source) { |
| 262 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; | 262 return [ source + "onDOMContentLoaded", target + "onBeforeNavigate"]; |
| 263 } | 263 } |
| OLD | NEW |