Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/test/data/extensions/api_test/webnavigation/failures/test_failures.js

Issue 1670673003: Refactor the implementation of the webNavigation extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Bug-532666-NavigationHandleAPI
Patch Set: Remove UI thread DCHECKs. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // An page that tries to load an non-existent iframe. 11 // An page that tries to load an non-existent iframe.
12 function nonExistentIframe() { 12 function nonExistentIframe() {
13 expect([ 13 expect([
14 { label: "a-onBeforeNavigate", 14 { label: "a-onBeforeNavigate",
15 event: "onBeforeNavigate", 15 event: "onBeforeNavigate",
16 details: { frameId: 0, 16 details: { frameId: 0,
17 parentFrameId: -1, 17 parentFrameId: -1,
18 processId: 0, 18 processId: -1,
19 tabId: 0, 19 tabId: 0,
20 timeStamp: 0, 20 timeStamp: 0,
21 url: getURL('d.html') }}, 21 url: getURL('d.html') }},
22 { label: "a-onCommitted", 22 { label: "a-onCommitted",
23 event: "onCommitted", 23 event: "onCommitted",
24 details: { frameId: 0, 24 details: { frameId: 0,
25 processId: 0, 25 processId: 0,
26 tabId: 0, 26 tabId: 0,
27 timeStamp: 0, 27 timeStamp: 0,
28 transitionQualifiers: [], 28 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
39 event: "onCompleted", 39 event: "onCompleted",
40 details: { frameId: 0, 40 details: { frameId: 0,
41 processId: 0, 41 processId: 0,
42 tabId: 0, 42 tabId: 0,
43 timeStamp: 0, 43 timeStamp: 0,
44 url: getURL('d.html') }}, 44 url: getURL('d.html') }},
45 { label: "b-onBeforeNavigate", 45 { label: "b-onBeforeNavigate",
46 event: "onBeforeNavigate", 46 event: "onBeforeNavigate",
47 details: { frameId: 1, 47 details: { frameId: 1,
48 parentFrameId: 0, 48 parentFrameId: 0,
49 processId: 0, 49 processId: -1,
50 tabId: 0, 50 tabId: 0,
51 timeStamp: 0, 51 timeStamp: 0,
52 url: getURL('c.html') }}, 52 url: getURL('c.html') }},
53 { label: "b-onErrorOccurred", 53 { label: "b-onErrorOccurred",
54 event: "onErrorOccurred", 54 event: "onErrorOccurred",
55 details: { error: "net::ERR_FILE_NOT_FOUND", 55 details: { error: "net::ERR_FILE_NOT_FOUND",
56 frameId: 1, 56 frameId: 1,
57 processId: 0, 57 processId: -1,
58 tabId: 0, 58 tabId: 0,
59 timeStamp: 0, 59 timeStamp: 0,
60 url: getURL('c.html') }}], 60 url: getURL('c.html') }}],
61 [navigationOrder("a-"), 61 [navigationOrder("a-"),
62 ["a-onCommitted", "b-onBeforeNavigate", "b-onErrorOccurred", 62 ["a-onCommitted", "b-onBeforeNavigate", "b-onErrorOccurred",
63 "a-onCompleted"]]); 63 "a-onCompleted"]]);
64 chrome.tabs.update(tabId, { url: getURL('d.html') }); 64 chrome.tabs.update(tabId, { url: getURL('d.html') });
65 }, 65 },
66 66
67 // An iframe navigates to a non-existent page. 67 // An iframe navigates to a non-existent page.
68 function nonExistentIframeNavigation() { 68 function nonExistentIframeNavigation() {
69 expect([ 69 expect([
70 { label: "a-onBeforeNavigate", 70 { label: "a-onBeforeNavigate",
71 event: "onBeforeNavigate", 71 event: "onBeforeNavigate",
72 details: { frameId: 0, 72 details: { frameId: 0,
73 parentFrameId: -1, 73 parentFrameId: -1,
74 processId: 0, 74 processId: -1,
75 tabId: 0, 75 tabId: 0,
76 timeStamp: 0, 76 timeStamp: 0,
77 url: getURL('a.html') }}, 77 url: getURL('a.html') }},
78 { label: "a-onCommitted", 78 { label: "a-onCommitted",
79 event: "onCommitted", 79 event: "onCommitted",
80 details: { frameId: 0, 80 details: { frameId: 0,
81 processId: 0, 81 processId: 0,
82 tabId: 0, 82 tabId: 0,
83 timeStamp: 0, 83 timeStamp: 0,
84 transitionQualifiers: [], 84 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
95 event: "onCompleted", 95 event: "onCompleted",
96 details: { frameId: 0, 96 details: { frameId: 0,
97 processId: 0, 97 processId: 0,
98 tabId: 0, 98 tabId: 0,
99 timeStamp: 0, 99 timeStamp: 0,
100 url: getURL('a.html') }}, 100 url: getURL('a.html') }},
101 { label: "b-onBeforeNavigate", 101 { label: "b-onBeforeNavigate",
102 event: "onBeforeNavigate", 102 event: "onBeforeNavigate",
103 details: { frameId: 1, 103 details: { frameId: 1,
104 parentFrameId: 0, 104 parentFrameId: 0,
105 processId: 0, 105 processId: -1,
106 tabId: 0, 106 tabId: 0,
107 timeStamp: 0, 107 timeStamp: 0,
108 url: getURL('b.html') }}, 108 url: getURL('b.html') }},
109 { label: "b-onCommitted", 109 { label: "b-onCommitted",
110 event: "onCommitted", 110 event: "onCommitted",
111 details: { frameId: 1, 111 details: { frameId: 1,
112 processId: 0, 112 processId: 0,
113 tabId: 0, 113 tabId: 0,
114 timeStamp: 0, 114 timeStamp: 0,
115 transitionQualifiers: [], 115 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
126 event: "onCompleted", 126 event: "onCompleted",
127 details: { frameId: 1, 127 details: { frameId: 1,
128 processId: 0, 128 processId: 0,
129 tabId: 0, 129 tabId: 0,
130 timeStamp: 0, 130 timeStamp: 0,
131 url: getURL('b.html') }}, 131 url: getURL('b.html') }},
132 { label: "c-onBeforeNavigate", 132 { label: "c-onBeforeNavigate",
133 event: "onBeforeNavigate", 133 event: "onBeforeNavigate",
134 details: { frameId: 1, 134 details: { frameId: 1,
135 parentFrameId: 0, 135 parentFrameId: 0,
136 processId: 0, 136 processId: -1,
137 tabId: 0, 137 tabId: 0,
138 timeStamp: 0, 138 timeStamp: 0,
139 url: getURL('c.html') }}, 139 url: getURL('c.html') }},
140 { label: "c-onErrorOccurred", 140 { label: "c-onErrorOccurred",
141 event: "onErrorOccurred", 141 event: "onErrorOccurred",
142 details: { error: "net::ERR_FILE_NOT_FOUND", 142 details: { error: "net::ERR_FILE_NOT_FOUND",
143 frameId: 1, 143 frameId: 1,
144 processId: 0, 144 processId: -1,
145 tabId: 0, 145 tabId: 0,
146 timeStamp: 0, 146 timeStamp: 0,
147 url: getURL('c.html') }}], 147 url: getURL('c.html') }}],
148 [ navigationOrder("a-"), 148 [ navigationOrder("a-"),
149 navigationOrder("b-"), 149 navigationOrder("b-"),
150 isIFrameOf("b-", "a-"), 150 isIFrameOf("b-", "a-"),
151 isLoadedBy("c-", "b-"), 151 isLoadedBy("c-", "b-"),
152 ["c-onBeforeNavigate", "c-onErrorOccurred"]]); 152 ["c-onBeforeNavigate", "c-onErrorOccurred"]]);
153 chrome.tabs.update(tabId, { url: getURL('a.html') }); 153 chrome.tabs.update(tabId, { url: getURL('a.html') });
154 }, 154 },
155 155
156 // Cancel a navigation after it is already committed. 156 // Cancel a navigation after it is already committed.
157 function cancel() { 157 function cancel() {
158 expect([ 158 expect([
159 { label: "onBeforeNavigate", 159 { label: "onBeforeNavigate",
160 event: "onBeforeNavigate", 160 event: "onBeforeNavigate",
161 details: { frameId: 0, 161 details: { frameId: 0,
162 parentFrameId: -1, 162 parentFrameId: -1,
163 processId: 0, 163 processId: -1,
164 tabId: 0, 164 tabId: 0,
165 timeStamp: 0, 165 timeStamp: 0,
166 url: getURL('e.html') }}, 166 url: getURL('e.html') }},
167 { label: "onCommitted", 167 { label: "onCommitted",
168 event: "onCommitted", 168 event: "onCommitted",
169 details: { frameId: 0, 169 details: { frameId: 0,
170 processId: 0, 170 processId: 0,
171 tabId: 0, 171 tabId: 0,
172 timeStamp: 0, 172 timeStamp: 0,
173 transitionQualifiers: [], 173 transitionQualifiers: [],
(...skipping 16 matching lines...) Expand all
190 // otherwise the non-existant URL breaks tests that follow, since loading 190 // otherwise the non-existant URL breaks tests that follow, since loading
191 // those test pages is seen as a non-extension -> extension URL 191 // those test pages is seen as a non-extension -> extension URL
192 // transition, which is forbidden by web_accessible_resources enforcement 192 // transition, which is forbidden by web_accessible_resources enforcement
193 // in manifest version 2.) 193 // in manifest version 2.)
194 function nonExistent() { 194 function nonExistent() {
195 expect([ 195 expect([
196 { label: "onBeforeNavigate", 196 { label: "onBeforeNavigate",
197 event: "onBeforeNavigate", 197 event: "onBeforeNavigate",
198 details: { frameId: 0, 198 details: { frameId: 0,
199 parentFrameId: -1, 199 parentFrameId: -1,
200 processId: 0, 200 processId: -1,
201 tabId: 0, 201 tabId: 0,
202 timeStamp: 0, 202 timeStamp: 0,
203 url: getURL('nonexistent.html') }}, 203 url: getURL('nonexistent.html') }},
204 { label: "onErrorOccurred", 204 { label: "onErrorOccurred",
205 event: "onErrorOccurred", 205 event: "onErrorOccurred",
206 details: { error: "net::ERR_FILE_NOT_FOUND", 206 details: { error: "net::ERR_FILE_NOT_FOUND",
207 frameId: 0, 207 frameId: 0,
208 processId: 0, 208 processId: -1,
209 tabId: 0, 209 tabId: 0,
210 timeStamp: 0, 210 timeStamp: 0,
211 url: getURL('nonexistent.html') }}], 211 url: getURL('nonexistent.html') }}],
212 [["onBeforeNavigate", "onErrorOccurred"]]); 212 [["onBeforeNavigate", "onErrorOccurred"]]);
213 chrome.tabs.update(tabId, { url: getURL('nonexistent.html') }); 213 chrome.tabs.update(tabId, { url: getURL('nonexistent.html') });
214 }, 214 },
215 ]); 215 ]);
216 }); 216 });
217 }; 217 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698