| 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 onload = function() { | 5 onload = function() { |
| 6 var getURL = chrome.extension.getURL; | 6 var getURL = chrome.extension.getURL; |
| 7 chrome.tabs.create({"url": "about:blank"}, function(tab) { | 7 chrome.tabs.create({"url": "about:blank"}, function(tab) { |
| 8 var tabId = tab.id; | 8 var tabId = tab.id; |
| 9 | 9 |
| 10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
| 11 // Navigates to a.html which includes b.html as an iframe. b.html | 11 // Navigates to a.html which includes b.html as an iframe. b.html |
| 12 // redirects to c.html. | 12 // redirects to c.html. |
| 13 function iframe() { | 13 function iframe() { |
| 14 expect([ | 14 expect([ |
| 15 { label: "a-onBeforeNavigate", | 15 { label: "a-onBeforeNavigate", |
| 16 event: "onBeforeNavigate", | 16 event: "onBeforeNavigate", |
| 17 details: { frameId: 0, | 17 details: { frameId: 0, |
| 18 parentFrameId: -1, | 18 parentFrameId: -1, |
| 19 processId: 0, | 19 processId: -1, |
| 20 tabId: 0, | 20 tabId: 0, |
| 21 timeStamp: 0, | 21 timeStamp: 0, |
| 22 url: getURL('a.html') }}, | 22 url: getURL('a.html') }}, |
| 23 { label: "a-onCommitted", | 23 { label: "a-onCommitted", |
| 24 event: "onCommitted", | 24 event: "onCommitted", |
| 25 details: { frameId: 0, | 25 details: { frameId: 0, |
| 26 processId: 0, | 26 processId: 0, |
| 27 tabId: 0, | 27 tabId: 0, |
| 28 timeStamp: 0, | 28 timeStamp: 0, |
| 29 transitionQualifiers: [], | 29 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 event: "onCompleted", | 40 event: "onCompleted", |
| 41 details: { frameId: 0, | 41 details: { frameId: 0, |
| 42 processId: 0, | 42 processId: 0, |
| 43 tabId: 0, | 43 tabId: 0, |
| 44 timeStamp: 0, | 44 timeStamp: 0, |
| 45 url: getURL('a.html') }}, | 45 url: getURL('a.html') }}, |
| 46 { label: "b-onBeforeNavigate", | 46 { label: "b-onBeforeNavigate", |
| 47 event: "onBeforeNavigate", | 47 event: "onBeforeNavigate", |
| 48 details: { frameId: 1, | 48 details: { frameId: 1, |
| 49 parentFrameId: 0, | 49 parentFrameId: 0, |
| 50 processId: 0, | 50 processId: -1, |
| 51 tabId: 0, | 51 tabId: 0, |
| 52 timeStamp: 0, | 52 timeStamp: 0, |
| 53 url: getURL('b.html') }}, | 53 url: getURL('b.html') }}, |
| 54 { label: "b-onCommitted", | 54 { label: "b-onCommitted", |
| 55 event: "onCommitted", | 55 event: "onCommitted", |
| 56 details: { frameId: 1, | 56 details: { frameId: 1, |
| 57 processId: 0, | 57 processId: 0, |
| 58 tabId: 0, | 58 tabId: 0, |
| 59 timeStamp: 0, | 59 timeStamp: 0, |
| 60 transitionQualifiers: [], | 60 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 event: "onCompleted", | 71 event: "onCompleted", |
| 72 details: { frameId: 1, | 72 details: { frameId: 1, |
| 73 processId: 0, | 73 processId: 0, |
| 74 tabId: 0, | 74 tabId: 0, |
| 75 timeStamp: 0, | 75 timeStamp: 0, |
| 76 url: getURL('b.html') }}, | 76 url: getURL('b.html') }}, |
| 77 { label: "c-onBeforeNavigate", | 77 { label: "c-onBeforeNavigate", |
| 78 event: "onBeforeNavigate", | 78 event: "onBeforeNavigate", |
| 79 details: { frameId: 1, | 79 details: { frameId: 1, |
| 80 parentFrameId: 0, | 80 parentFrameId: 0, |
| 81 processId: 0, | 81 processId: -1, |
| 82 tabId: 0, | 82 tabId: 0, |
| 83 timeStamp: 0, | 83 timeStamp: 0, |
| 84 url: getURL('c.html') }}, | 84 url: getURL('c.html') }}, |
| 85 { label: "c-onCommitted", | 85 { label: "c-onCommitted", |
| 86 event: "onCommitted", | 86 event: "onCommitted", |
| 87 details: { frameId: 1, | 87 details: { frameId: 1, |
| 88 processId: 0, | 88 processId: 0, |
| 89 tabId: 0, | 89 tabId: 0, |
| 90 timeStamp: 0, | 90 timeStamp: 0, |
| 91 transitionQualifiers: [], | 91 transitionQualifiers: [], |
| (...skipping 23 matching lines...) Expand all Loading... |
| 115 | 115 |
| 116 // Navigates to d.html which includes e.html and f.html as iframes. To be | 116 // Navigates to d.html which includes e.html and f.html as iframes. To be |
| 117 // able to predict which iframe has which id, the iframe for f.html is | 117 // able to predict which iframe has which id, the iframe for f.html is |
| 118 // created by javascript. f.html then navigates to g.html. | 118 // created by javascript. f.html then navigates to g.html. |
| 119 function iframeMultiple() { | 119 function iframeMultiple() { |
| 120 expect([ | 120 expect([ |
| 121 { label: "d-onBeforeNavigate", | 121 { label: "d-onBeforeNavigate", |
| 122 event: "onBeforeNavigate", | 122 event: "onBeforeNavigate", |
| 123 details: { frameId: 0, | 123 details: { frameId: 0, |
| 124 parentFrameId: -1, | 124 parentFrameId: -1, |
| 125 processId: 0, | 125 processId: -1, |
| 126 tabId: 0, | 126 tabId: 0, |
| 127 timeStamp: 0, | 127 timeStamp: 0, |
| 128 url: getURL('d.html') }}, | 128 url: getURL('d.html') }}, |
| 129 { label: "d-onCommitted", | 129 { label: "d-onCommitted", |
| 130 event: "onCommitted", | 130 event: "onCommitted", |
| 131 details: { frameId: 0, | 131 details: { frameId: 0, |
| 132 processId: 0, | 132 processId: 0, |
| 133 tabId: 0, | 133 tabId: 0, |
| 134 timeStamp: 0, | 134 timeStamp: 0, |
| 135 transitionQualifiers: [], | 135 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 146 event: "onCompleted", | 146 event: "onCompleted", |
| 147 details: { frameId: 0, | 147 details: { frameId: 0, |
| 148 processId: 0, | 148 processId: 0, |
| 149 tabId: 0, | 149 tabId: 0, |
| 150 timeStamp: 0, | 150 timeStamp: 0, |
| 151 url: getURL('d.html') }}, | 151 url: getURL('d.html') }}, |
| 152 { label: "e-onBeforeNavigate", | 152 { label: "e-onBeforeNavigate", |
| 153 event: "onBeforeNavigate", | 153 event: "onBeforeNavigate", |
| 154 details: { frameId: 1, | 154 details: { frameId: 1, |
| 155 parentFrameId: 0, | 155 parentFrameId: 0, |
| 156 processId: 0, | 156 processId: -1, |
| 157 tabId: 0, | 157 tabId: 0, |
| 158 timeStamp: 0, | 158 timeStamp: 0, |
| 159 url: getURL('e.html') }}, | 159 url: getURL('e.html') }}, |
| 160 { label: "e-onCommitted", | 160 { label: "e-onCommitted", |
| 161 event: "onCommitted", | 161 event: "onCommitted", |
| 162 details: { frameId: 1, | 162 details: { frameId: 1, |
| 163 processId: 0, | 163 processId: 0, |
| 164 tabId: 0, | 164 tabId: 0, |
| 165 timeStamp: 0, | 165 timeStamp: 0, |
| 166 transitionQualifiers: [], | 166 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 177 event: "onCompleted", | 177 event: "onCompleted", |
| 178 details: { frameId: 1, | 178 details: { frameId: 1, |
| 179 processId: 0, | 179 processId: 0, |
| 180 tabId: 0, | 180 tabId: 0, |
| 181 timeStamp: 0, | 181 timeStamp: 0, |
| 182 url: getURL('e.html') }}, | 182 url: getURL('e.html') }}, |
| 183 { label: "f-onBeforeNavigate", | 183 { label: "f-onBeforeNavigate", |
| 184 event: "onBeforeNavigate", | 184 event: "onBeforeNavigate", |
| 185 details: { frameId: 2, | 185 details: { frameId: 2, |
| 186 parentFrameId: 0, | 186 parentFrameId: 0, |
| 187 processId: 0, | 187 processId: -1, |
| 188 tabId: 0, | 188 tabId: 0, |
| 189 timeStamp: 0, | 189 timeStamp: 0, |
| 190 url: getURL('f.html') }}, | 190 url: getURL('f.html') }}, |
| 191 { label: "f-onCommitted", | 191 { label: "f-onCommitted", |
| 192 event: "onCommitted", | 192 event: "onCommitted", |
| 193 details: { frameId: 2, | 193 details: { frameId: 2, |
| 194 processId: 0, | 194 processId: 0, |
| 195 tabId: 0, | 195 tabId: 0, |
| 196 timeStamp: 0, | 196 timeStamp: 0, |
| 197 transitionQualifiers: [], | 197 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 208 event: "onCompleted", | 208 event: "onCompleted", |
| 209 details: { frameId: 2, | 209 details: { frameId: 2, |
| 210 processId: 0, | 210 processId: 0, |
| 211 tabId: 0, | 211 tabId: 0, |
| 212 timeStamp: 0, | 212 timeStamp: 0, |
| 213 url: getURL('f.html') }}, | 213 url: getURL('f.html') }}, |
| 214 { label: "g-onBeforeNavigate", | 214 { label: "g-onBeforeNavigate", |
| 215 event: "onBeforeNavigate", | 215 event: "onBeforeNavigate", |
| 216 details: { frameId: 2, | 216 details: { frameId: 2, |
| 217 parentFrameId: 0, | 217 parentFrameId: 0, |
| 218 processId: 0, | 218 processId: -1, |
| 219 tabId: 0, | 219 tabId: 0, |
| 220 timeStamp: 0, | 220 timeStamp: 0, |
| 221 url: getURL('g.html') }}, | 221 url: getURL('g.html') }}, |
| 222 { label: "g-onCommitted", | 222 { label: "g-onCommitted", |
| 223 event: "onCommitted", | 223 event: "onCommitted", |
| 224 details: { frameId: 2, | 224 details: { frameId: 2, |
| 225 processId: 0, | 225 processId: 0, |
| 226 tabId: 0, | 226 tabId: 0, |
| 227 timeStamp: 0, | 227 timeStamp: 0, |
| 228 transitionQualifiers: [], | 228 transitionQualifiers: [], |
| (...skipping 25 matching lines...) Expand all Loading... |
| 254 }, | 254 }, |
| 255 | 255 |
| 256 // Navigates to h.html which includes i.html that triggers a navigation | 256 // Navigates to h.html which includes i.html that triggers a navigation |
| 257 // on the main frame. | 257 // on the main frame. |
| 258 function iframeNavigate() { | 258 function iframeNavigate() { |
| 259 expect([ | 259 expect([ |
| 260 { label: "h-onBeforeNavigate", | 260 { label: "h-onBeforeNavigate", |
| 261 event: "onBeforeNavigate", | 261 event: "onBeforeNavigate", |
| 262 details: { frameId: 0, | 262 details: { frameId: 0, |
| 263 parentFrameId: -1, | 263 parentFrameId: -1, |
| 264 processId: 0, | 264 processId: -1, |
| 265 tabId: 0, | 265 tabId: 0, |
| 266 timeStamp: 0, | 266 timeStamp: 0, |
| 267 url: getURL('h.html') }}, | 267 url: getURL('h.html') }}, |
| 268 { label: "h-onCommitted", | 268 { label: "h-onCommitted", |
| 269 event: "onCommitted", | 269 event: "onCommitted", |
| 270 details: { frameId: 0, | 270 details: { frameId: 0, |
| 271 processId: 0, | 271 processId: 0, |
| 272 tabId: 0, | 272 tabId: 0, |
| 273 timeStamp: 0, | 273 timeStamp: 0, |
| 274 transitionQualifiers: [], | 274 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 285 event: "onCompleted", | 285 event: "onCompleted", |
| 286 details: { frameId: 0, | 286 details: { frameId: 0, |
| 287 processId: 0, | 287 processId: 0, |
| 288 tabId: 0, | 288 tabId: 0, |
| 289 timeStamp: 0, | 289 timeStamp: 0, |
| 290 url: getURL('h.html') }}, | 290 url: getURL('h.html') }}, |
| 291 { label: "i-onBeforeNavigate", | 291 { label: "i-onBeforeNavigate", |
| 292 event: "onBeforeNavigate", | 292 event: "onBeforeNavigate", |
| 293 details: { frameId: 1, | 293 details: { frameId: 1, |
| 294 parentFrameId: 0, | 294 parentFrameId: 0, |
| 295 processId: 0, | 295 processId: -1, |
| 296 tabId: 0, | 296 tabId: 0, |
| 297 timeStamp: 0, | 297 timeStamp: 0, |
| 298 url: getURL('i.html') }}, | 298 url: getURL('i.html') }}, |
| 299 { label: "i-onCommitted", | 299 { label: "i-onCommitted", |
| 300 event: "onCommitted", | 300 event: "onCommitted", |
| 301 details: { frameId: 1, | 301 details: { frameId: 1, |
| 302 processId: 0, | 302 processId: 0, |
| 303 tabId: 0, | 303 tabId: 0, |
| 304 timeStamp: 0, | 304 timeStamp: 0, |
| 305 transitionQualifiers: [], | 305 transitionQualifiers: [], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 316 event: "onCompleted", | 316 event: "onCompleted", |
| 317 details: { frameId: 1, | 317 details: { frameId: 1, |
| 318 processId: 0, | 318 processId: 0, |
| 319 tabId: 0, | 319 tabId: 0, |
| 320 timeStamp: 0, | 320 timeStamp: 0, |
| 321 url: getURL('i.html') }}, | 321 url: getURL('i.html') }}, |
| 322 { label: "c-onBeforeNavigate", | 322 { label: "c-onBeforeNavigate", |
| 323 event: "onBeforeNavigate", | 323 event: "onBeforeNavigate", |
| 324 details: { frameId: 0, | 324 details: { frameId: 0, |
| 325 parentFrameId: -1, | 325 parentFrameId: -1, |
| 326 processId: 0, | 326 processId: -1, |
| 327 tabId: 0, | 327 tabId: 0, |
| 328 timeStamp: 0, | 328 timeStamp: 0, |
| 329 url: getURL('c.html') }}, | 329 url: getURL('c.html') }}, |
| 330 { label: "c-onCommitted", | 330 { label: "c-onCommitted", |
| 331 event: "onCommitted", | 331 event: "onCommitted", |
| 332 details: { frameId: 0, | 332 details: { frameId: 0, |
| 333 processId: 0, | 333 processId: 0, |
| 334 tabId: 0, | 334 tabId: 0, |
| 335 timeStamp: 0, | 335 timeStamp: 0, |
| 336 transitionQualifiers: ['maybe_client_redirect'], | 336 transitionQualifiers: ['maybe_client_redirect'], |
| (...skipping 16 matching lines...) Expand all Loading... |
| 353 [ navigationOrder("h-"), | 353 [ navigationOrder("h-"), |
| 354 navigationOrder("i-"), | 354 navigationOrder("i-"), |
| 355 navigationOrder("c-"), | 355 navigationOrder("c-"), |
| 356 isIFrameOf("i-", "h-"), | 356 isIFrameOf("i-", "h-"), |
| 357 isLoadedBy("c-", "i-") ]); | 357 isLoadedBy("c-", "i-") ]); |
| 358 chrome.tabs.update(tabId, { url: getURL('h.html') }); | 358 chrome.tabs.update(tabId, { url: getURL('h.html') }); |
| 359 }, | 359 }, |
| 360 ]); | 360 ]); |
| 361 }); | 361 }); |
| 362 }; | 362 }; |
| OLD | NEW |