Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 onload = function() { | 5 onload = function() { |
| 6 debug = true; | 6 debug = true; |
| 7 var getURL = chrome.extension.getURL; | 7 var getURL = chrome.extension.getURL; |
| 8 var URL_MAIN = getURL('main.html'); | 8 var URL_MAIN = getURL('main.html'); |
| 9 var URL_FRAME1 = 'http://a.com:PORT/extensions/api_test/webnavigation/' + | 9 var URL_FRAME1 = 'http://a.com:PORT/extensions/api_test/webnavigation/' + |
| 10 'crossProcessIframe/frame.html'; | 10 'crossProcessIframe/frame.html'; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 // c. Loaded by the parent frame. | 29 // c. Loaded by the parent frame. |
| 30 // d. Navigated by the parent frame. | 30 // d. Navigated by the parent frame. |
| 31 // e. Navigated by the child frame. | 31 // e. Navigated by the child frame. |
| 32 // Tests whether the frameId stays constant across navigations. | 32 // Tests whether the frameId stays constant across navigations. |
| 33 function crossProcessIframe() { | 33 function crossProcessIframe() { |
| 34 expect([ | 34 expect([ |
| 35 { label: 'main-onBeforeNavigate', | 35 { label: 'main-onBeforeNavigate', |
| 36 event: 'onBeforeNavigate', | 36 event: 'onBeforeNavigate', |
| 37 details: { frameId: 0, | 37 details: { frameId: 0, |
| 38 parentFrameId: -1, | 38 parentFrameId: -1, |
| 39 processId: 0, | 39 processId: -1, |
| 40 tabId: 0, | 40 tabId: 0, |
| 41 timeStamp: 0, | 41 timeStamp: 0, |
| 42 url: URL_MAIN }}, | 42 url: URL_MAIN }}, |
| 43 { label: 'main-onCommitted', | 43 { label: 'main-onCommitted', |
| 44 event: 'onCommitted', | 44 event: 'onCommitted', |
| 45 details: { frameId: 0, | 45 details: { frameId: 0, |
| 46 processId: 0, | 46 processId: 0, |
| 47 tabId: 0, | 47 tabId: 0, |
| 48 timeStamp: 0, | 48 timeStamp: 0, |
| 49 transitionQualifiers: [], | 49 transitionQualifiers: [], |
| 50 transitionType: 'link', | 50 transitionType: 'link', |
| 51 url: URL_MAIN }}, | 51 url: URL_MAIN }}, |
| 52 { label: 'main-onDOMContentLoaded', | 52 { label: 'main-onDOMContentLoaded', |
| 53 event: 'onDOMContentLoaded', | 53 event: 'onDOMContentLoaded', |
| 54 details: { frameId: 0, | 54 details: { frameId: 0, |
| 55 processId: 0, | 55 processId: 0, |
| 56 tabId: 0, | 56 tabId: 0, |
| 57 timeStamp: 0, | 57 timeStamp: 0, |
| 58 url: URL_MAIN }}, | 58 url: URL_MAIN }}, |
| 59 { label: 'main-onCompleted', | 59 { label: 'main-onCompleted', |
| 60 event: 'onCompleted', | 60 event: 'onCompleted', |
| 61 details: { frameId: 0, | 61 details: { frameId: 0, |
| 62 processId: 0, | 62 processId: 0, |
| 63 tabId: 0, | 63 tabId: 0, |
| 64 timeStamp: 0, | 64 timeStamp: 0, |
| 65 url: URL_MAIN }}, | 65 url: URL_MAIN }}, |
| 66 // pre-a.com is the navigation before the process swap. | |
| 67 { label: 'pre-a.com-onBeforeNavigate', | |
| 68 event: 'onBeforeNavigate', | |
| 69 details: { frameId: 1, | |
| 70 parentFrameId: 0, | |
| 71 processId: 0, | |
| 72 tabId: 0, | |
| 73 timeStamp: 0, | |
| 74 url: URL_FRAME1 }}, | |
| 75 { label: 'pre-a.com-onErrorOccurred', | |
| 76 event: 'onErrorOccurred', | |
| 77 details: { error: 'net::ERR_ABORTED', | |
| 78 frameId: 1, | |
| 79 processId: 0, | |
| 80 tabId: 0, | |
| 81 timeStamp: 0, | |
| 82 url: URL_FRAME1 }}, | |
| 83 { label: 'a.com-onBeforeNavigate', | 66 { label: 'a.com-onBeforeNavigate', |
| 84 event: 'onBeforeNavigate', | 67 event: 'onBeforeNavigate', |
| 85 details: { frameId: 1, | 68 details: { frameId: 1, |
| 86 parentFrameId: 0, | 69 parentFrameId: 0, |
| 87 processId: 1, | 70 processId: -1, |
| 88 tabId: 0, | 71 tabId: 0, |
| 89 timeStamp: 0, | 72 timeStamp: 0, |
| 90 url: URL_FRAME1 }}, | 73 url: URL_FRAME1 }}, |
| 91 { label: 'a.com-onCommitted', | 74 { label: 'a.com-onCommitted', |
| 92 event: 'onCommitted', | 75 event: 'onCommitted', |
| 93 details: { frameId: 1, | 76 details: { frameId: 1, |
| 94 processId: 1, | 77 processId: 1, |
| 95 tabId: 0, | 78 tabId: 0, |
| 96 timeStamp: 0, | 79 timeStamp: 0, |
| 97 transitionQualifiers: [], | 80 transitionQualifiers: [], |
| 98 transitionType: 'auto_subframe', | 81 transitionType: 'auto_subframe', |
| 99 url: URL_FRAME1 }}, | 82 url: URL_FRAME1 }}, |
| 100 { label: 'a.com-onDOMContentLoaded', | 83 { label: 'a.com-onDOMContentLoaded', |
| 101 event: 'onDOMContentLoaded', | 84 event: 'onDOMContentLoaded', |
| 102 details: { frameId: 1, | 85 details: { frameId: 1, |
| 103 processId: 1, | 86 processId: 1, |
| 104 tabId: 0, | 87 tabId: 0, |
| 105 timeStamp: 0, | 88 timeStamp: 0, |
| 106 url: URL_FRAME1 }}, | 89 url: URL_FRAME1 }}, |
| 107 { label: 'a.com-onCompleted', | 90 { label: 'a.com-onCompleted', |
| 108 event: 'onCompleted', | 91 event: 'onCompleted', |
| 109 details: { frameId: 1, | 92 details: { frameId: 1, |
| 110 processId: 1, | 93 processId: 1, |
| 111 tabId: 0, | 94 tabId: 0, |
| 112 timeStamp: 0, | 95 timeStamp: 0, |
| 113 url: URL_FRAME1 }}, | 96 url: URL_FRAME1 }}, |
| 114 // There is no onBeforeNavigate and onErrorOccurred (like the other | 97 // There is no onBeforeNavigate and onErrorOccurred (like the other |
|
Devlin
2016/02/05 18:30:28
Does this need to be updated? (since there are no
nasko
2016/02/05 23:41:22
Done.
| |
| 115 // navigations in this test) because this navigation is triggered by | 98 // navigations in this test) because this navigation is triggered by |
| 116 // a frame in a different process, so the navigation directly goes | 99 // a frame in a different process, so the navigation directly goes |
| 117 // through the browser. This difference will be resolved once | 100 // through the browser. This difference will be resolved once |
| 118 // PlzNavigate goes live. | 101 // PlzNavigate goes live. |
| 119 { label: 'b.com-onBeforeNavigate', | 102 { label: 'b.com-onBeforeNavigate', |
| 120 event: 'onBeforeNavigate', | 103 event: 'onBeforeNavigate', |
| 121 details: { frameId: 1, | 104 details: { frameId: 1, |
| 122 parentFrameId: 0, | 105 parentFrameId: 0, |
| 123 processId: 2, | 106 processId: -1, |
| 124 tabId: 0, | 107 tabId: 0, |
| 125 timeStamp: 0, | 108 timeStamp: 0, |
| 126 url: URL_FRAME2 }}, | 109 url: URL_FRAME2 }}, |
| 127 { label: 'b.com-onCommitted', | 110 { label: 'b.com-onCommitted', |
| 128 event: 'onCommitted', | 111 event: 'onCommitted', |
| 129 details: { frameId: 1, | 112 details: { frameId: 1, |
| 130 processId: 2, | 113 processId: 2, |
| 131 tabId: 0, | 114 tabId: 0, |
| 132 timeStamp: 0, | 115 timeStamp: 0, |
| 133 transitionQualifiers: [], | 116 transitionQualifiers: [], |
| 134 transitionType: 'manual_subframe', | 117 transitionType: 'manual_subframe', |
| 135 url: URL_FRAME2 }}, | 118 url: URL_FRAME2 }}, |
| 136 { label: 'b.com-onDOMContentLoaded', | 119 { label: 'b.com-onDOMContentLoaded', |
| 137 event: 'onDOMContentLoaded', | 120 event: 'onDOMContentLoaded', |
| 138 details: { frameId: 1, | 121 details: { frameId: 1, |
| 139 processId: 2, | 122 processId: 2, |
| 140 tabId: 0, | 123 tabId: 0, |
| 141 timeStamp: 0, | 124 timeStamp: 0, |
| 142 url: URL_FRAME2 }}, | 125 url: URL_FRAME2 }}, |
| 143 { label: 'b.com-onCompleted', | 126 { label: 'b.com-onCompleted', |
| 144 event: 'onCompleted', | 127 event: 'onCompleted', |
| 145 details: { frameId: 1, | 128 details: { frameId: 1, |
| 146 processId: 2, | 129 processId: 2, |
| 147 tabId: 0, | 130 tabId: 0, |
| 148 timeStamp: 0, | 131 timeStamp: 0, |
| 149 url: URL_FRAME2 }}, | 132 url: URL_FRAME2 }}, |
| 150 // pre-c.com is the navigation before the process swap. | |
| 151 { label: 'pre-c.com-onBeforeNavigate', | |
| 152 event: 'onBeforeNavigate', | |
| 153 details: { frameId: 1, | |
| 154 parentFrameId: 0, | |
| 155 processId: 2, | |
| 156 tabId: 0, | |
| 157 timeStamp: 0, | |
| 158 url: URL_FRAME3 }}, | |
| 159 { label: 'pre-c.com-onErrorOccurred', | |
| 160 event: 'onErrorOccurred', | |
| 161 details: { error: 'net::ERR_ABORTED', | |
| 162 frameId: 1, | |
| 163 processId: 2, | |
| 164 tabId: 0, | |
| 165 timeStamp: 0, | |
| 166 url: URL_FRAME3 }}, | |
| 167 { label: 'c.com-onBeforeNavigate', | 133 { label: 'c.com-onBeforeNavigate', |
| 168 event: 'onBeforeNavigate', | 134 event: 'onBeforeNavigate', |
| 169 details: { frameId: 1, | 135 details: { frameId: 1, |
| 170 parentFrameId: 0, | 136 parentFrameId: 0, |
| 171 processId: 3, | 137 processId: -1, |
| 172 tabId: 0, | 138 tabId: 0, |
| 173 timeStamp: 0, | 139 timeStamp: 0, |
| 174 url: URL_FRAME3 }}, | 140 url: URL_FRAME3 }}, |
| 175 { label: 'c.com-onCommitted', | 141 { label: 'c.com-onCommitted', |
| 176 event: 'onCommitted', | 142 event: 'onCommitted', |
| 177 details: { frameId: 1, | 143 details: { frameId: 1, |
| 178 processId: 3, | 144 processId: 3, |
| 179 tabId: 0, | 145 tabId: 0, |
| 180 timeStamp: 0, | 146 timeStamp: 0, |
| 181 transitionQualifiers: [], | 147 transitionQualifiers: [], |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 193 details: { frameId: 1, | 159 details: { frameId: 1, |
| 194 processId: 3, | 160 processId: 3, |
| 195 tabId: 0, | 161 tabId: 0, |
| 196 timeStamp: 0, | 162 timeStamp: 0, |
| 197 url: URL_FRAME3 }}], | 163 url: URL_FRAME3 }}], |
| 198 [ | 164 [ |
| 199 navigationOrder('main-'), | 165 navigationOrder('main-'), |
| 200 navigationOrder('a.com-'), | 166 navigationOrder('a.com-'), |
| 201 navigationOrder('b.com-'), | 167 navigationOrder('b.com-'), |
| 202 navigationOrder('c.com-'), | 168 navigationOrder('c.com-'), |
| 203 ['pre-a.com-onBeforeNavigate', 'a.com-onBeforeNavigate', | 169 ['a.com-onCommitted', 'b.com-onBeforeNavigate'], |
| 204 'pre-a.com-onErrorOccurred'], | 170 ['b.com-onCommitted', 'c.com-onBeforeNavigate'], |
| 205 ['pre-c.com-onBeforeNavigate', 'c.com-onBeforeNavigate', | 171 ]); |
| 206 'pre-c.com-onErrorOccurred']]); | |
| 207 | 172 |
| 208 chrome.tabs.update(tabId, { | 173 chrome.tabs.update(tabId, { |
| 209 url: URL_MAIN + '?' + config.testServer.port | 174 url: URL_MAIN + '?' + config.testServer.port |
| 210 }); | 175 }); |
| 211 }, | 176 }, |
| 212 | 177 |
| 213 ]); | 178 ]); |
| 214 }); | 179 }); |
| 215 }); | 180 }); |
| 216 }; | 181 }; |
| OLD | NEW |