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

Side by Side Diff: chrome/test/data/extensions/api_test/webnavigation/crossProcessFragment/test_crossProcessFragment.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: 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 var URL_TEST = "http://127.0.0.1:PORT/test"; 7 var URL_TEST = "http://127.0.0.1:PORT/test";
8 chrome.tabs.create({"url": "about:blank"}, function(tab) { 8 chrome.tabs.create({"url": "about:blank"}, function(tab) {
9 var tabId = tab.id; 9 var tabId = tab.id;
10 chrome.test.getConfig(function(config) { 10 chrome.test.getConfig(function(config) {
11 var fixPort = function(url) { 11 var fixPort = function(url) {
12 return url.replace(/PORT/g, config.testServer.port); 12 return url.replace(/PORT/g, config.testServer.port);
13 }; 13 };
14 URL_TEST = fixPort(URL_TEST); 14 URL_TEST = fixPort(URL_TEST);
15 let areExtensionsIsolated = config.isolateExtensions;
Devlin 2016/02/05 18:30:28 I could have sworn let only worked with "use stric
nasko 2016/02/05 23:41:22 Tends to work and I copied it from other places we
15 16
16 chrome.test.runTests([ 17 chrome.test.runTests([
17 // Navigates to a different site, but then modifies the reference 18 // Navigates to a different site, but then modifies the reference
18 // framgent. 19 // framgent.
19 function crossProcessFragment() { 20 function crossProcessFragment() {
20 expect([ 21 expect([
21 { label: "a-onBeforeNavigate", 22 { label: "a-onBeforeNavigate",
22 event: "onBeforeNavigate", 23 event: "onBeforeNavigate",
23 details: { frameId: 0, 24 details: { frameId: 0,
24 parentFrameId: -1, 25 parentFrameId: -1,
25 processId: 0, 26 processId: -1,
26 tabId: 0, 27 tabId: 0,
27 timeStamp: 0, 28 timeStamp: 0,
28 url: getURL('f.html') }}, 29 url: getURL('f.html') }},
29 { label: "a-onCommitted", 30 { label: "a-onCommitted",
30 event: "onCommitted", 31 event: "onCommitted",
31 details: { frameId: 0, 32 details: { frameId: 0,
32 processId: 0, 33 processId: 0,
33 tabId: 0, 34 tabId: 0,
34 timeStamp: 0, 35 timeStamp: 0,
35 transitionQualifiers: [], 36 transitionQualifiers: [],
(...skipping 19 matching lines...) Expand all
55 processId: 0, 56 processId: 0,
56 tabId: 0, 57 tabId: 0,
57 timeStamp: 0, 58 timeStamp: 0,
58 transitionQualifiers: [], 59 transitionQualifiers: [],
59 transitionType: "link", 60 transitionType: "link",
60 url: getURL('f.html#foo') }}, 61 url: getURL('f.html#foo') }},
61 { label: "b-onBeforeNavigate", 62 { label: "b-onBeforeNavigate",
62 event: "onBeforeNavigate", 63 event: "onBeforeNavigate",
63 details: { frameId: 0, 64 details: { frameId: 0,
64 parentFrameId: -1, 65 parentFrameId: -1,
65 processId: 1, 66 processId: -1,
66 tabId: 0, 67 tabId: 0,
67 timeStamp: 0, 68 timeStamp: 0,
68 url: URL_TEST + "3" }}, 69 url: URL_TEST + "3" }},
69 { label: "b-onCommitted", 70 { label: "b-onCommitted",
70 event: "onCommitted", 71 event: "onCommitted",
71 details: { frameId: 0, 72 details: { frameId: 0,
72 processId: 1, 73 processId: 1,
73 tabId: 0, 74 tabId: 0,
74 timeStamp: 0, 75 timeStamp: 0,
75 transitionQualifiers: [], 76 transitionQualifiers: [],
(...skipping 24 matching lines...) Expand all
100 }, 101 },
101 102
102 // A page with an iframe that changes its reference fragment before 103 // A page with an iframe that changes its reference fragment before
103 // the iframe committed. 104 // the iframe committed.
104 function crossProcessFragmentIFrame() { 105 function crossProcessFragmentIFrame() {
105 expect([ 106 expect([
106 { label: "a-onBeforeNavigate", 107 { label: "a-onBeforeNavigate",
107 event: "onBeforeNavigate", 108 event: "onBeforeNavigate",
108 details: { frameId: 0, 109 details: { frameId: 0,
109 parentFrameId: -1, 110 parentFrameId: -1,
110 processId: 0, 111 processId: -1,
111 tabId: 0, 112 tabId: 0,
112 timeStamp: 0, 113 timeStamp: 0,
113 url: getURL('g.html') }}, 114 url: getURL('g.html') }},
114 { label: "a-onCommitted", 115 { label: "a-onCommitted",
115 event: "onCommitted", 116 event: "onCommitted",
116 details: { frameId: 0, 117 details: { frameId: 0,
117 processId: 0, 118 processId: 0,
118 tabId: 0, 119 tabId: 0,
119 timeStamp: 0, 120 timeStamp: 0,
120 transitionQualifiers: [], 121 transitionQualifiers: [],
(...skipping 19 matching lines...) Expand all
140 processId: 0, 141 processId: 0,
141 tabId: 0, 142 tabId: 0,
142 timeStamp: 0, 143 timeStamp: 0,
143 transitionQualifiers: [], 144 transitionQualifiers: [],
144 transitionType: "link", 145 transitionType: "link",
145 url: getURL('g.html#foo') }}, 146 url: getURL('g.html#foo') }},
146 { label: "b-onBeforeNavigate", 147 { label: "b-onBeforeNavigate",
147 event: "onBeforeNavigate", 148 event: "onBeforeNavigate",
148 details: { frameId: 1, 149 details: { frameId: 1,
149 parentFrameId: 0, 150 parentFrameId: 0,
150 processId: 0, 151 processId: -1,
151 tabId: 0, 152 tabId: 0,
152 timeStamp: 0, 153 timeStamp: 0,
153 url: URL_TEST + "4" }}, 154 url: URL_TEST + "4" }},
154 { label: "b-onCommitted", 155 { label: "b-onCommitted",
155 event: "onCommitted", 156 event: "onCommitted",
156 details: { frameId: 1, 157 details: { frameId: 1,
157 processId: 0, 158 processId: (areExtensionsIsolated ? 1 : 0),
158 tabId: 0, 159 tabId: 0,
159 timeStamp: 0, 160 timeStamp: 0,
160 transitionQualifiers: [], 161 transitionQualifiers: [],
161 transitionType: "auto_subframe", 162 transitionType: "auto_subframe",
162 url: URL_TEST + "4" }}, 163 url: URL_TEST + "4" }},
163 { label: "b-onDOMContentLoaded", 164 { label: "b-onDOMContentLoaded",
164 event: "onDOMContentLoaded", 165 event: "onDOMContentLoaded",
165 details: { frameId: 1, 166 details: { frameId: 1,
166 processId: 0, 167 processId: (areExtensionsIsolated ? 1 : 0),
167 tabId: 0, 168 tabId: 0,
168 timeStamp: 0, 169 timeStamp: 0,
169 url: URL_TEST + "4" }}, 170 url: URL_TEST + "4" }},
170 { label: "b-onCompleted", 171 { label: "b-onCompleted",
171 event: "onCompleted", 172 event: "onCompleted",
172 details: { frameId: 1, 173 details: { frameId: 1,
173 processId: 0, 174 processId: (areExtensionsIsolated ? 1 : 0),
174 tabId: 0, 175 tabId: 0,
175 timeStamp: 0, 176 timeStamp: 0,
176 url: URL_TEST + "4" }}], 177 url: URL_TEST + "4" }}],
177 [ navigationOrder("a-"), navigationOrder("b-"), 178 [ navigationOrder("a-"), navigationOrder("b-"),
178 [ "a-onCompleted", "b-onBeforeNavigate", 179 [ "a-onCompleted", "b-onBeforeNavigate",
179 "a-onReferenceFragmentUpdated"] ]); 180 "a-onReferenceFragmentUpdated"] ]);
180 181
181 chrome.tabs.update( 182 chrome.tabs.update(
182 tabId, 183 tabId,
183 { url: getURL('g.html?' + 184 { url: getURL('g.html?' +
184 config.testServer.port) }); 185 config.testServer.port) });
185 }, 186 },
186 187
187 ]); 188 ]);
188 }); 189 });
189 }); 190 });
190 }; 191 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698