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
3 // found in the LICENSE file.
6 var getURL = chrome.extension.getURL;
7 chrome.tabs.create({"url": "about:blank"}, function(tab) {
10 chrome.test.runTests([
11 // Opens a new tab from javascript.
14 { label: "a-onBeforeNavigate",
15 event: "onBeforeNavigate",
16 details: { frameId: 0,
21 url: getURL('a.html') }},
22 { label: "a-onCommitted",
24 details: { frameId: 0,
28 transitionQualifiers: [],
29 transitionType: "link",
30 url: getURL('a.html') }},
31 { label: "a-onDOMContentLoaded",
32 event: "onDOMContentLoaded",
33 details: { frameId: 0,
37 url: getURL('a.html') }},
38 { label: "a-onCompleted",
40 details: { frameId: 0,
44 url: getURL('a.html') }},
45 { label: "a-onCreatedNavigationTarget",
46 event: "onCreatedNavigationTarget",
47 details: { sourceFrameId: 0,
52 url: getURL('b.html') }},
53 { label: "b-onBeforeNavigate",
54 event: "onBeforeNavigate",
55 details: { frameId: 0,
60 url: getURL('b.html') }},
61 { label: "b-onCommitted",
63 details: { frameId: 0,
67 transitionQualifiers: [],
68 transitionType: "link",
69 url: getURL('b.html') }},
70 { label: "b-onDOMContentLoaded",
71 event: "onDOMContentLoaded",
72 details: { frameId: 0,
76 url: getURL('b.html') }},
77 { label: "b-onCompleted",
79 details: { frameId: 0,
83 url: getURL('b.html') }}],
84 [ navigationOrder("a-"),
85 navigationOrder("b-"),
86 ["a-onDOMContentLoaded", "a-onCreatedNavigationTarget",
87 "b-onBeforeNavigate"]]);
88 chrome.tabs.update(tabId, { url: getURL('a.html') });
91 // Opens a new tab from javascript within an iframe.
92 function openTabFrame() {
94 { label: "c-onBeforeNavigate",
95 event: "onBeforeNavigate",
96 details: { frameId: 0,
101 url: getURL('c.html') }},
102 { label: "c-onCommitted",
103 event: "onCommitted",
104 details: { frameId: 0,
108 transitionQualifiers: [],
109 transitionType: "link",
110 url: getURL('c.html') }},
111 { label: "c-onDOMContentLoaded",
112 event: "onDOMContentLoaded",
113 details: { frameId: 0,
117 url: getURL('c.html') }},
118 { label: "c-onCompleted",
119 event: "onCompleted",
120 details: { frameId: 0,
124 url: getURL('c.html') }},
125 { label: "a-onBeforeNavigate",
126 event: "onBeforeNavigate",
127 details: { frameId: 1,
132 url: getURL('a.html') }},
133 { label: "a-onCommitted",
134 event: "onCommitted",
135 details: { frameId: 1,
139 transitionQualifiers: [],
140 transitionType: "auto_subframe",
141 url: getURL('a.html') }},
142 { label: "a-onDOMContentLoaded",
143 event: "onDOMContentLoaded",
144 details: { frameId: 1,
148 url: getURL('a.html') }},
149 { label: "a-onCompleted",
150 event: "onCompleted",
151 details: { frameId: 1,
155 url: getURL('a.html') }},
156 { label: "a-onCreatedNavigationTarget",
157 event: "onCreatedNavigationTarget",
158 details: { sourceFrameId: 1,
163 url: getURL('b.html') }},
164 { label: "b-onBeforeNavigate",
165 event: "onBeforeNavigate",
166 details: { frameId: 0,
171 url: getURL('b.html') }},
172 { label: "b-onCommitted",
173 event: "onCommitted",
174 details: { frameId: 0,
178 transitionQualifiers: [],
179 transitionType: "link",
180 url: getURL('b.html') }},
181 { label: "b-onDOMContentLoaded",
182 event: "onDOMContentLoaded",
183 details: { frameId: 0,
187 url: getURL('b.html') }},
188 { label: "b-onCompleted",
189 event: "onCompleted",
190 details: { frameId: 0,
194 url: getURL('b.html') }}],
195 [ navigationOrder("a-"),
196 navigationOrder("b-"),
197 navigationOrder("c-"),
198 isIFrameOf("a-", "c-"),
199 ["a-onDOMContentLoaded", "a-onCreatedNavigationTarget",
200 "b-onBeforeNavigate"]]);
201 chrome.tabs.update(tabId, { url: getURL('c.html') });