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 function runTests() { |
6 var getURL = chrome.extension.getURL; | 6 var getURL = chrome.extension.getURL; |
7 var URL_LOAD = | 7 var URL_LOAD = |
8 "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank
/a.html"; | 8 "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank
/a.html"; |
9 var URL_TARGET = | 9 var URL_TARGET = |
10 "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank
/b.html"; | 10 "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank
/b.html"; |
11 chrome.tabs.create({"url": "about:blank"}, function(tab) { | 11 chrome.tabs.create({"url": "about:blank"}, function(tab) { |
12 var tabId = tab.id; | 12 var tabId = tab.id; |
13 chrome.test.getConfig(function(config) { | 13 chrome.test.getConfig(function(config) { |
14 var fixPort = function(url) { | 14 var fixPort = function(url) { |
15 return url.replace(/PORT/g, config.testServer.port); | 15 return url.replace(/PORT/g, config.testServer.port); |
16 }; | 16 }; |
17 URL_LOAD = fixPort(URL_LOAD); | 17 URL_LOAD = fixPort(URL_LOAD); |
18 URL_TARGET = fixPort(URL_TARGET); | 18 URL_TARGET = fixPort(URL_TARGET); |
19 | 19 |
20 chrome.test.runTests([ | 20 chrome.test.runTests([ |
21 // Opens a tab and waits for the user to click on a link with | 21 // Opens a tab and waits for the user to click on a link with |
22 // target=_blank in it. | 22 // target=_blank in it. |
23 function targetBlank() { | 23 function targetBlank() { |
24 expect([ | 24 expect([ |
25 { label: "a-onBeforeNavigate", | 25 { label: "a-onBeforeNavigate", |
26 event: "onBeforeNavigate", | 26 event: "onBeforeNavigate", |
27 details: { frameId: 0, | 27 details: { frameId: 0, |
| 28 processId: 0, |
28 tabId: 0, | 29 tabId: 0, |
29 timeStamp: 0, | 30 timeStamp: 0, |
30 url: URL_LOAD }}, | 31 url: URL_LOAD }}, |
31 { label: "a-onCommitted", | 32 { label: "a-onCommitted", |
32 event: "onCommitted", | 33 event: "onCommitted", |
33 details: { frameId: 0, | 34 details: { frameId: 0, |
| 35 processId: 0, |
34 tabId: 0, | 36 tabId: 0, |
35 timeStamp: 0, | 37 timeStamp: 0, |
36 transitionQualifiers: [], | 38 transitionQualifiers: [], |
37 transitionType: "link", | 39 transitionType: "link", |
38 url: URL_LOAD }}, | 40 url: URL_LOAD }}, |
39 { label: "a-onDOMContentLoaded", | 41 { label: "a-onDOMContentLoaded", |
40 event: "onDOMContentLoaded", | 42 event: "onDOMContentLoaded", |
41 details: { frameId: 0, | 43 details: { frameId: 0, |
| 44 processId: 0, |
42 tabId: 0, | 45 tabId: 0, |
43 timeStamp: 0, | 46 timeStamp: 0, |
44 url: URL_LOAD }}, | 47 url: URL_LOAD }}, |
45 { label: "a-onCompleted", | 48 { label: "a-onCompleted", |
46 event: "onCompleted", | 49 event: "onCompleted", |
47 details: { frameId: 0, | 50 details: { frameId: 0, |
| 51 processId: 0, |
48 tabId: 0, | 52 tabId: 0, |
49 timeStamp: 0, | 53 timeStamp: 0, |
50 url: URL_LOAD }}, | 54 url: URL_LOAD }}, |
51 { label: "b-onCreatedNavigationTarget", | 55 { label: "b-onCreatedNavigationTarget", |
52 event: "onCreatedNavigationTarget", | 56 event: "onCreatedNavigationTarget", |
53 details: { sourceFrameId: 0, | 57 details: { sourceFrameId: 0, |
| 58 sourceProcessId: 0, |
54 sourceTabId: 0, | 59 sourceTabId: 0, |
55 tabId: 1, | 60 tabId: 1, |
56 timeStamp: 0, | 61 timeStamp: 0, |
57 url: URL_TARGET }}, | 62 url: URL_TARGET }}, |
58 { label: "b-onBeforeNavigate", | 63 { label: "b-onBeforeNavigate", |
59 event: "onBeforeNavigate", | 64 event: "onBeforeNavigate", |
60 details: { frameId: 0, | 65 details: { frameId: 0, |
| 66 processId: 0, |
61 tabId: 1, | 67 tabId: 1, |
62 timeStamp: 0, | 68 timeStamp: 0, |
63 url: URL_TARGET }}, | 69 url: URL_TARGET }}, |
64 { label: "b-onCommitted", | 70 { label: "b-onCommitted", |
65 event: "onCommitted", | 71 event: "onCommitted", |
66 details: { frameId: 0, | 72 details: { frameId: 0, |
| 73 processId: 0, |
67 tabId: 1, | 74 tabId: 1, |
68 timeStamp: 0, | 75 timeStamp: 0, |
69 transitionQualifiers: [], | 76 transitionQualifiers: [], |
70 transitionType: "link", | 77 transitionType: "link", |
71 url: URL_TARGET }}, | 78 url: URL_TARGET }}, |
72 { label: "b-onDOMContentLoaded", | 79 { label: "b-onDOMContentLoaded", |
73 event: "onDOMContentLoaded", | 80 event: "onDOMContentLoaded", |
74 details: { frameId: 0, | 81 details: { frameId: 0, |
| 82 processId: 0, |
75 tabId: 1, | 83 tabId: 1, |
76 timeStamp: 0, | 84 timeStamp: 0, |
77 url: URL_TARGET }}, | 85 url: URL_TARGET }}, |
78 { label: "b-onCompleted", | 86 { label: "b-onCompleted", |
79 event: "onCompleted", | 87 event: "onCompleted", |
80 details: { frameId: 0, | 88 details: { frameId: 0, |
| 89 processId: 0, |
81 tabId: 1, | 90 tabId: 1, |
82 timeStamp: 0, | 91 timeStamp: 0, |
83 url: URL_TARGET }}], | 92 url: URL_TARGET }}], |
84 [ navigationOrder("a-"), | 93 [ navigationOrder("a-"), |
85 navigationOrder("b-"), | 94 navigationOrder("b-"), |
86 [ "a-onDOMContentLoaded", | 95 [ "a-onDOMContentLoaded", |
87 "b-onCreatedNavigationTarget", | 96 "b-onCreatedNavigationTarget", |
88 "b-onBeforeNavigate" ]]); | 97 "b-onBeforeNavigate" ]]); |
89 | 98 |
90 // Notify the api test that we're waiting for the user. | 99 // Notify the api test that we're waiting for the user. |
91 chrome.test.notifyPass(); | 100 chrome.test.notifyPass(); |
92 }, | 101 }, |
93 ]); | 102 ]); |
94 }); | 103 }); |
95 }); | 104 }); |
96 } | 105 } |
OLD | NEW |