summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 23:12:47 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 23:12:47 +0000
commit81219f7b519ebd87f8d3e97d23ebf197acfa50da (patch)
tree4bc8f37bc04c2cc81af042caa33cf434d213a28e /chrome_frame/test
parent3863684df708b2f084999017e1071208df82c46c (diff)
downloadchromium_src-81219f7b519ebd87f8d3e97d23ebf197acfa50da.zip
chromium_src-81219f7b519ebd87f8d3e97d23ebf197acfa50da.tar.gz
chromium_src-81219f7b519ebd87f8d3e97d23ebf197acfa50da.tar.bz2
Pass the accept and cache-control headers from ChromeFrame via the host network stack.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=57455 Bug=57455 Test=Covered by updated ChromeFrame test. Review URL: http://codereview.chromium.org/3536005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r--chrome_frame/test/data/xmlhttprequest_authorization_header_test.html53
-rw-r--r--chrome_frame/test/data/xmlhttprequest_header_test.html66
-rw-r--r--chrome_frame/test/test_with_web_server.cc8
3 files changed, 70 insertions, 57 deletions
diff --git a/chrome_frame/test/data/xmlhttprequest_authorization_header_test.html b/chrome_frame/test/data/xmlhttprequest_authorization_header_test.html
deleted file mode 100644
index 9d084bf..0000000
--- a/chrome_frame/test/data/xmlhttprequest_authorization_header_test.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
- <head>
- <meta http-equiv="x-ua-compatible" content="chrome=1" />
- <title>ChromeFrame XHR Authorization header test</title>
- <script type="text/javascript"
- src="chrome_frame_tester_helpers.js"></script>
-
- <script type="text/javascript">
- function ValidateUserAgent() {
- if (isRunningInMSIE()) {
- onFailure("FullTab_XMLHttpRequestAuthorizationHeaderTest", 1,
- "Failed");
- }
-
- SendXHRRequest();
- }
-
- function SendXHRRequest() {
- var test_name = "FullTabModeIE_XHRAuthHeaderTest";
- var xhr = getXHRObject();
- if (!xhr) {
- onFailure(test_name, 1, "Failed to get XHR object");
- }
-
- var request_uri = AppendArgumentsToBaseUrl("echoheader?",
- "Authorization");
-
- xhr.open("GET", request_uri, false);
- xhr.setRequestHeader('Authorization', 'Basic');
-
- try {
- xhr.send(null);
- var pos = xhr.responseText.indexOf("Basic");
- if (pos >= 0) {
- appendStatus("Received authorization header: " + xhr.responseText);
- onSuccess(test_name, 1);
- } else {
- onFailure(test_name, 1, "Failed to find auth header in response.");
- }
- } catch (e) {
- appendStatus("XHR send failed. Error: " + e.description);
- onFailure(test_name, 1, "Failed to send XHR request");
- }
- }
- </script>
- </head>
-
- <body onLoad="setTimeout(ValidateUserAgent, 100);">
- ChromeFrame full tab mode XMLHttpRequest authorization header test.
- Verifies that authorization headers set by XML HTTP requests make it via
- the host network stack.
- </body>
-</html>
diff --git a/chrome_frame/test/data/xmlhttprequest_header_test.html b/chrome_frame/test/data/xmlhttprequest_header_test.html
new file mode 100644
index 0000000..83a220e
--- /dev/null
+++ b/chrome_frame/test/data/xmlhttprequest_header_test.html
@@ -0,0 +1,66 @@
+<html>
+ <head>
+ <meta http-equiv="x-ua-compatible" content="chrome=1" />
+ <title>ChromeFrame XHR Authorization header test</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function ValidateUserAgent() {
+ if (isRunningInMSIE()) {
+ onFailure("FullTab_XMLHttpRequestAuthorizationHeaderTest", 1,
+ "Failed");
+ return;
+ }
+ if (!SendHeader("Authorization", "Basic"))
+ return;
+ if (!SendHeader("accept", "application/json"))
+ return
+ if (SendHeader("cache-control", "no-cache")) {
+ onSuccess("FullTabModeIE_XHRHeaderTest", 1);
+ }
+ }
+
+ function ValidateResponse(xhr, ExpectedValue) {
+ var pos = xhr.responseText.indexOf(ExpectedValue);
+ if (pos >= 0) {
+ return true;
+ }
+ return false;
+ }
+
+ function SendHeader(header, header_value) {
+ var test_name = "FullTabModeIE_XHRHeaderTest";
+ var xhr = getXHRObject();
+ if (!xhr) {
+ onFailure(test_name, 1, "Failed to get XHR object");
+ }
+ var request_uri = AppendArgumentsToBaseUrl("echoheader?",
+ header);
+ xhr.open("GET", request_uri, false);
+ xhr.setRequestHeader(header, header_value);
+
+ try {
+ xhr.send(null);
+ if (ValidateResponse(xhr, header_value)) {
+ appendStatus("Received header: " + xhr.responseText);
+ return true;
+ } else {
+ onFailure(test_name, 1,
+ "Failed to find header in response.");
+ }
+ } catch (e) {
+ appendStatus("XHR send failed. Error: " + e.description);
+ onFailure(test_name, 1, "Failed to send XHR request");
+ }
+ return false;
+ }
+ </script>
+ </head>
+
+ <body onLoad="setTimeout(ValidateUserAgent, 100);">
+ ChromeFrame full tab mode XMLHttpRequest HTTP header tests.
+ Verifies that HTTP headers set by XML HTTP requests make it via
+ the host network stack.
+ </body>
+</html>
diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc
index 178d073..ad94c86 100644
--- a/chrome_frame/test/test_with_web_server.cc
+++ b/chrome_frame/test/test_with_web_server.cc
@@ -902,11 +902,11 @@ TEST_F(ChromeFrameTestWithWebServer,
SimpleBrowserTest(FIREFOX, kMultipleCFInstancesTestUrl);
}
-const wchar_t kXHRAuthHeaderTestUrl[] =
- L"xmlhttprequest_authorization_header_test.html";
+const wchar_t kXHRHeaderTestUrl[] =
+ L"xmlhttprequest_header_test.html";
-TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_XHRAuthHeaderTest) {
- SimpleBrowserTest(IE, kXHRAuthHeaderTestUrl);
+TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_XHRHeaderTest) {
+ SimpleBrowserTest(IE, kXHRHeaderTestUrl);
}
const wchar_t kDeleteCookieTest[] =