Chromium Code Reviews| 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 function runTests() { | 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 non-existant page. | |
| 12 function nonExistant() { | |
| 13 expect([ | |
| 14 { label: "onBeforeNavigate", | |
| 15 event: "onBeforeNavigate", | |
| 16 details: { frameId: 0, | |
| 17 processId: 0, | |
| 18 tabId: 0, | |
| 19 timeStamp: 0, | |
| 20 url: getURL('failures/nonexistant.html') }}, | |
| 21 { label: "onErrorOccurred", | |
| 22 event: "onErrorOccurred", | |
| 23 details: { error: "net::ERR_FILE_NOT_FOUND", | |
| 24 frameId: 0, | |
| 25 processId: 0, | |
| 26 tabId: 0, | |
| 27 timeStamp: 0, | |
| 28 url: getURL('failures/nonexistant.html') }}], | |
| 29 [["onBeforeNavigate", "onErrorOccurred"]]); | |
| 30 chrome.tabs.update(tabId, { url: getURL('failures/nonexistant.html') }); | |
| 31 }, | |
| 32 | |
| 33 // An page that tries to load an non-existant iframe. | 11 // An page that tries to load an non-existant iframe. |
| 34 function nonExistantIframe() { | 12 function nonExistantIframe() { |
| 35 expect([ | 13 expect([ |
| 36 { label: "a-onBeforeNavigate", | 14 { label: "a-onBeforeNavigate", |
| 37 event: "onBeforeNavigate", | 15 event: "onBeforeNavigate", |
| 38 details: { frameId: 0, | 16 details: { frameId: 0, |
| 39 processId: 0, | 17 processId: 0, |
| 40 tabId: 0, | 18 tabId: 0, |
| 41 timeStamp: 0, | 19 timeStamp: 0, |
| 42 url: getURL('failures/d.html') }}, | 20 url: getURL('failures/d.html') }}, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 details: { error: "net::ERR_ABORTED", | 179 details: { error: "net::ERR_ABORTED", |
| 202 frameId: 0, | 180 frameId: 0, |
| 203 processId: 0, | 181 processId: 0, |
| 204 tabId: 0, | 182 tabId: 0, |
| 205 timeStamp: 0, | 183 timeStamp: 0, |
| 206 url: getURL('failures/e.html') }}], | 184 url: getURL('failures/e.html') }}], |
| 207 [["onBeforeNavigate", "onCommitted", "onDOMContentLoaded", | 185 [["onBeforeNavigate", "onCommitted", "onDOMContentLoaded", |
| 208 "onErrorOccurred"]]); | 186 "onErrorOccurred"]]); |
| 209 chrome.tabs.update(tabId, { url: getURL('failures/e.html') }); | 187 chrome.tabs.update(tabId, { url: getURL('failures/e.html') }); |
| 210 }, | 188 }, |
| 189 | |
| 190 // Navigates to a non-existant page (this test case must be last, | |
|
miket_OOO
2012/08/06 22:33:28
non-existent
Mihai Parparita -not on Chrome
2012/08/09 23:04:08
Fixed all.
| |
| 191 // otherwise the non-existed URL breaks tests that follow, since loading | |
|
miket_OOO
2012/08/06 22:33:28
non-existent (or maybe non-existing?)
| |
| 192 // those test pages is seen as a non-extension -> extension URL | |
| 193 // transition, which is forbidden by web_accessible_resources enforcement | |
| 194 // in manifest version 2. | |
| 195 function nonExistant() { | |
|
miket_OOO
2012/08/06 22:33:28
nonExistent
| |
| 196 expect([ | |
| 197 { label: "onBeforeNavigate", | |
| 198 event: "onBeforeNavigate", | |
| 199 details: { frameId: 0, | |
| 200 processId: 0, | |
| 201 tabId: 0, | |
| 202 timeStamp: 0, | |
| 203 url: getURL('failures/nonexistant.html') }}, | |
|
miket_OOO
2012/08/06 22:33:28
nonexistent.html
| |
| 204 { label: "onErrorOccurred", | |
| 205 event: "onErrorOccurred", | |
| 206 details: { error: "net::ERR_FILE_NOT_FOUND", | |
| 207 frameId: 0, | |
| 208 processId: 0, | |
| 209 tabId: 0, | |
| 210 timeStamp: 0, | |
| 211 url: getURL('failures/nonexistant.html') }}], | |
|
miket_OOO
2012/08/06 22:33:28
etc.
| |
| 212 [["onBeforeNavigate", "onErrorOccurred"]]); | |
| 213 chrome.tabs.update(tabId, { url: getURL('failures/nonexistant.html') }); | |
| 214 }, | |
| 211 ]); | 215 ]); |
| 212 }); | 216 }); |
| 213 } | 217 }; |
| OLD | NEW |