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

Side by Side Diff: chrome/test/data/extensions/api_test/webrequest/test_post.js

Issue 10694055: Add read-only access to POST data for webRequest's onBeforeRequest (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Deleting a forgotten comment Created 8 years, 5 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
(Empty)
1 // Copyright (c) 2011 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.
4
5 function postData(formFile, includePostData) {
6 var postData = {
7 chck: ["option_A"],
8 pw: ["pw"],
9 radio: ["Yes"],
10 select: ["one"],
11 text1: ["TEST_TEXT_1"],
12 text2: ["TEST_TEXT_2"],
13 text3: ["TEST_TEXT_3"],
14 txtarea: ["Text"]
15 };
16 return function submitForm() {
17 expect(
18 [ // events
19 { label: "a-onBeforeRequest",
20 event: "onBeforeRequest",
21 details: {
22 //frameId: 0,
battre 2012/07/11 12:28:43 nit: space after // (also below)
vabr (Chromium) 2012/07/12 15:13:11 Actually, those comments were there by mistake. Re
23 method: "GET",
24 //parentFrameId: -1,
25 //tabId: 0,
26 type: "main_frame",
27 url: getURL("postData/" + formFile),
28 frameUrl: getURL("postData/" + formFile)
29 }
30 },
31 { label: "a-onResponseStarted",
32 event: "onResponseStarted",
33 details: {
34 //frameId: 0,
35 fromCache: false,
36 method: "GET",
37 //parentFrameId: -1,
38 statusCode: 200,
39 statusLine: "HTTP/1.1 200 OK",
40 //tabId: 0,
41 type: "main_frame",
42 url: getURL("postData/" + formFile)
43 }
44 },
45 { label: "a-onCompleted",
46 event: "onCompleted",
47 details: {
48 //frameId: 0,
49 fromCache: false,
50 method: "GET",
51 //parentFrameId: -1,
52 statusCode: 200,
53 statusLine: "HTTP/1.1 200 OK",
54 //tabId: 0,
55 type: "main_frame",
56 url: getURL("postData/" + formFile)
57 }
58 },
59 { label: "s-onBeforeRequest",
60 event: "onBeforeRequest",
61 details: {
62 //frameId: 0,
63 method: "GET",
64 //parentFrameId: -1,
65 //tabId: 0,
66 type: "script",
67 url: getURL("postData/submit.js"),
68 frameUrl: getURL("postData/" + formFile)
69 }
70 },
71 { label: "s-onResponseStarted",
72 event: "onResponseStarted",
73 details: {
74 //frameId: 0,
75 fromCache: false,
76 method: "GET",
77 //parentFrameId: -1,
78 statusCode: 200,
79 statusLine: "HTTP/1.1 200 OK",
80 //tabId: 0,
81 type: "script",
82 url: getURL("postData/submit.js")
83 }
84 },
85 { label: "s-onCompleted",
86 event: "onCompleted",
87 details: {
88 //frameId: 0,
89 fromCache: false,
90 method: "GET",
91 //parentFrameId: -1,
92 statusCode: 200,
93 statusLine: "HTTP/1.1 200 OK",
94 //tabId: 0,
95 type: "script",
96 url: getURL("postData/submit.js")
97 }
98 },
99 // b-onBeforeRequest with postData included...
100 (includePostData) ? { label: "b-onBeforeRequest",
101 event: "onBeforeRequest",
102 details: {
103 //frameId: 0,
104 method: "POST",
105 //parentFrameId: -1,
106 //tabId: 0,
107 type: "main_frame",
108 url: getURL("postData/nonExistingTarget.html"),
109 frameUrl: getURL("postData/nonExistingTarget.html"),
110 postData: postData
111 }
112 // or else b-onBeforeRequest without postData.
113 } : { label: "b-onBeforeRequest",
114 event: "onBeforeRequest",
115 details: {
116 //frameId: 0,
117 method: "POST",
118 //parentFrameId: -1,
119 //tabId: 0,
120 type: "main_frame",
121 url: getURL("postData/nonExistingTarget.html"),
122 frameUrl: getURL("postData/nonExistingTarget.html"),
123 }
124 },
125 { label: "b-onErrorOccurred",
126 event: "onErrorOccurred",
127 details: {
128 error: "net::ERR_FILE_NOT_FOUND",
129 //frameId: 0,
130 fromCache: false,
131 method: "POST",
132 //parentFrameId: -1,
133 //tabId: 0,
134 type: "main_frame",
135 url: getURL("postData/nonExistingTarget.html")
136 }
137 }
138 ],
139 [ // event order
140 ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted",
141 "s-onBeforeRequest", "s-onResponseStarted", "s-onCompleted",
142 "b-onBeforeRequest", "b-onErrorOccurred"]
143 ],
144 {urls: ["<all_urls>"]}, // filter
145 ["requestPostData"]);
146 navigateAndWait(getURL("postData/" + formFile));
147 close();
148 }
149 }
150
151 runTests([
152 // Navigates to a page with a form and submits it.
153 postData('no-enctype.html', true),
154 postData('urlencoded.html', true),
155 postData('multipart.html', true),
156 postData('plaintext.html', false),
157 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698