| 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 URL_LOAD = | 6 var URL_LOAD = |
| 7 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/a.htm
l"; | 7 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/a.htm
l"; |
| 8 var URL_TARGET = | 8 var URL_TARGET = |
| 9 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/b.htm
l"; | 9 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/b.htm
l"; |
| 10 chrome.tabs.create({"url": "about:blank"}, function(tab) { | 10 chrome.tabs.create({"url": "about:blank"}, function(tab) { |
| 11 var tabId = tab.id; | 11 var tabId = tab.id; |
| 12 chrome.test.getConfig(function(config) { | 12 chrome.test.getConfig(function(config) { |
| 13 var fixPort = function(url) { | 13 var fixPort = function(url) { |
| 14 return url.replace(/PORT/g, config.testServer.port); | 14 return url.replace(/PORT/g, config.testServer.port); |
| 15 }; | 15 }; |
| 16 URL_LOAD = fixPort(URL_LOAD); | 16 URL_LOAD = fixPort(URL_LOAD); |
| 17 URL_TARGET = fixPort(URL_TARGET); | 17 URL_TARGET = fixPort(URL_TARGET); |
| 18 | 18 |
| 19 chrome.test.runTests([ | 19 chrome.test.runTests([ |
| 20 // Opens a tab and waits for the user to click on a link with | 20 // Opens a tab and waits for the user to click on a link with |
| 21 // target=_blank in it. | 21 // target=_blank in it. |
| 22 function targetBlank() { | 22 function targetBlank() { |
| 23 expect([ | 23 expect([ |
| 24 { label: "a-onBeforeNavigate", | 24 { label: "a-onBeforeNavigate", |
| 25 event: "onBeforeNavigate", | 25 event: "onBeforeNavigate", |
| 26 details: { frameId: 0, | 26 details: { frameId: 0, |
| 27 parentFrameId: -1, | 27 parentFrameId: -1, |
| 28 processId: 0, | 28 processId: -1, |
| 29 tabId: 0, | 29 tabId: 0, |
| 30 timeStamp: 0, | 30 timeStamp: 0, |
| 31 url: URL_LOAD }}, | 31 url: URL_LOAD }}, |
| 32 { label: "a-onCommitted", | 32 { label: "a-onCommitted", |
| 33 event: "onCommitted", | 33 event: "onCommitted", |
| 34 details: { frameId: 0, | 34 details: { frameId: 0, |
| 35 processId: 0, | 35 processId: 0, |
| 36 tabId: 0, | 36 tabId: 0, |
| 37 timeStamp: 0, | 37 timeStamp: 0, |
| 38 transitionQualifiers: [], | 38 transitionQualifiers: [], |
| (...skipping 18 matching lines...) Expand all Loading... |
| 57 details: { sourceFrameId: 0, | 57 details: { sourceFrameId: 0, |
| 58 sourceProcessId: 0, | 58 sourceProcessId: 0, |
| 59 sourceTabId: 0, | 59 sourceTabId: 0, |
| 60 tabId: 1, | 60 tabId: 1, |
| 61 timeStamp: 0, | 61 timeStamp: 0, |
| 62 url: URL_TARGET }}, | 62 url: URL_TARGET }}, |
| 63 { label: "b-onBeforeNavigate", | 63 { label: "b-onBeforeNavigate", |
| 64 event: "onBeforeNavigate", | 64 event: "onBeforeNavigate", |
| 65 details: { frameId: 0, | 65 details: { frameId: 0, |
| 66 parentFrameId: -1, | 66 parentFrameId: -1, |
| 67 processId: 0, | 67 processId: -1, |
| 68 tabId: 1, | 68 tabId: 1, |
| 69 timeStamp: 0, | 69 timeStamp: 0, |
| 70 url: URL_TARGET }}, | 70 url: URL_TARGET }}, |
| 71 { label: "b-onCommitted", | 71 { label: "b-onCommitted", |
| 72 event: "onCommitted", | 72 event: "onCommitted", |
| 73 details: { frameId: 0, | 73 details: { frameId: 0, |
| 74 processId: 0, | 74 processId: 0, |
| 75 tabId: 1, | 75 tabId: 1, |
| 76 timeStamp: 0, | 76 timeStamp: 0, |
| 77 transitionQualifiers: [], | 77 transitionQualifiers: [], |
| (...skipping 19 matching lines...) Expand all Loading... |
| 97 "b-onCreatedNavigationTarget", | 97 "b-onCreatedNavigationTarget", |
| 98 "b-onBeforeNavigate" ]]); | 98 "b-onBeforeNavigate" ]]); |
| 99 | 99 |
| 100 // Notify the api test that we're waiting for the user. | 100 // Notify the api test that we're waiting for the user. |
| 101 chrome.test.notifyPass(); | 101 chrome.test.notifyPass(); |
| 102 }, | 102 }, |
| 103 ]); | 103 ]); |
| 104 }); | 104 }); |
| 105 }); | 105 }); |
| 106 }; | 106 }; |
| OLD | NEW |