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
3 // found in the LICENSE file.
5 // Common definitions for test_post?.js.
7 var dirName = "requestBody/";
9 function sendPost(formFile, parseableForm) {
10 // The following variables must be updated when files in |dirName| change.
12 "check": ["option_A"],
13 "password": ["password"],
16 "text\"1\u011B\u0161\u00FD\u4EBA\r\n \r\n": ["TEST_TEXT_1"],
17 "text2": ["TEST_TEXT_2"],
18 "text3": ["TEST_TEXT_3"],
19 "txtarea": ["text\"1\u011B\u0161\u00FD\u4EBA\r\n \r\n"]
21 return function submitForm() {
24 { label: "a-onBeforeRequest",
25 event: "onBeforeRequest",
29 url: getURL(dirName + formFile),
30 frameUrl: getURL(dirName + formFile)
33 { label: "a-onResponseStarted",
34 event: "onResponseStarted",
39 statusLine: "HTTP/1.1 200 OK",
41 url: getURL(dirName + formFile)
44 { label: "a-onCompleted",
50 statusLine: "HTTP/1.1 200 OK",
52 url: getURL(dirName + formFile)
55 { label: "s-onBeforeRequest",
56 event: "onBeforeRequest",
60 url: getURL("requestBody/submit.js"),
61 frameUrl: getURL(dirName + formFile)
64 { label: "s-onResponseStarted",
65 event: "onResponseStarted",
70 statusLine: "HTTP/1.1 200 OK",
72 url: getURL("requestBody/submit.js")
75 { label: "s-onCompleted",
81 statusLine: "HTTP/1.1 200 OK",
83 url: getURL("requestBody/submit.js")
86 { label: "b-onBeforeRequest",
87 event: "onBeforeRequest",
91 url: getURL("simpleLoad/a.html"),
92 frameUrl: getURL("simpleLoad/a.html"),
93 requestBody: parseableForm ? {
96 raw: [{bytes: {}}] // ArrayBuffer
100 { label: "b-onResponseStarted",
101 event: "onResponseStarted",
106 statusLine: "HTTP/1.1 200 OK",
108 url: getURL("simpleLoad/a.html")
111 { label: "b-onCompleted",
112 event: "onCompleted",
117 statusLine: "HTTP/1.1 200 OK",
119 url: getURL("simpleLoad/a.html")
124 ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted",
125 "s-onBeforeRequest", "s-onResponseStarted", "s-onCompleted",
126 "b-onBeforeRequest", "b-onResponseStarted", "b-onCompleted"]
128 {urls: ["<all_urls>"]}, // filter
130 navigateAndWait(getURL(dirName + formFile));