summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 21:12:23 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 21:12:23 +0000
commit7918c5068f2be01058e582077bec0b4aa221979a (patch)
treeb701bc9134b810128d574aad52e41b9449a17b72 /chrome_frame
parentc6d474f8e04b08306349ea514d529b8f25ffd4b2 (diff)
downloadchromium_src-7918c5068f2be01058e582077bec0b4aa221979a.zip
chromium_src-7918c5068f2be01058e582077bec0b4aa221979a.tar.gz
chromium_src-7918c5068f2be01058e582077bec0b4aa221979a.tar.bz2
Tommi, please review everything. jam please review changes to resource_dispatcher_host.cc
XMLHttpRequests issued by ChromeFrame instances would not use the host network stack at times. HTTP requests issued by these chrome instances are sent over automation to the host browser. This relies on the request having a renderer process id and a routing id for us to be able to intercept these requests. XHR requests are sent over to the browser via the ViewHostMsg_SyncLoad. This message has the routing id. However we always passed 0 down to the ResourceDispatcherHost::BeginRequest function which caused this to fail. Added a chrome frame specific unit test for this. Fixes bug http://code.google.com/p/chromium/issues/detail?id=30355 Bug=30355 Review URL: http://codereview.chromium.org/501040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/test/chrome_frame_unittests.cc15
-rw-r--r--chrome_frame/test/data/xmlhttprequest_test.html48
2 files changed, 63 insertions, 0 deletions
diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc
index ea7de65..9193f99 100644
--- a/chrome_frame/test/chrome_frame_unittests.cc
+++ b/chrome_frame/test/chrome_frame_unittests.cc
@@ -1651,3 +1651,18 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_BackForwardAnchor) {
mock.Uninitialize();
chrome_frame_test::CloseAllIEWindows();
}
+
+const wchar_t kChromeFrameFullTabModeXMLHttpRequestTestUrl[] =
+ L"files/xmlhttprequest_test.html";
+
+TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_ChromeFrameXHRTest) {
+ chrome_frame_test::TimedMsgLoop loop;
+
+ ASSERT_TRUE(LaunchBrowser(IE, kChromeFrameFullTabModeXMLHttpRequestTestUrl));
+
+ loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
+
+ chrome_frame_test::CloseAllIEWindows();
+ ASSERT_TRUE(CheckResultFile(L"FullTab_XMLHttpRequestTest", "OK"));
+}
+
diff --git a/chrome_frame/test/data/xmlhttprequest_test.html b/chrome_frame/test/data/xmlhttprequest_test.html
new file mode 100644
index 0000000..0672779
--- /dev/null
+++ b/chrome_frame/test/data/xmlhttprequest_test.html
@@ -0,0 +1,48 @@
+<html>
+ <head>
+ <meta http-equiv="x-ua-compatible" content="chrome=1" />
+ <title>ChromeFrame keyevent test</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function ValidateUserAgent() {
+ if (isRunningInMSIE()) {
+ onFailure("FullTab_XMLHttpRequestTest", 1, "Failed");
+ }
+
+ SendXHRRequest();
+ }
+
+ function SendXHRRequest() {
+ var xhr = getXHRObject();
+ if (!xhr) {
+ onFailure("FullTab_XMLHttpRequestTest", 1,
+ "Failed to get XHR object");
+ }
+
+ xhr.open("GET", "http://localhost:1337/echoheader?User-Agent", false);
+ try {
+ xhr.send(null);
+ var pos = xhr.responseText.indexOf("chromeframe");
+ if (pos >= 0) {
+ appendStatus("Received user agent: " + xhr.responseText);
+ onSuccess("FullTab_XMLHttpRequestTest", 1);
+ } else {
+ onFailure("FullTab_XMLHttpRequestTest", 1,
+ "Failed to find chromeframe in user agent.");
+ }
+ } catch (e) {
+ appendStatus("XHR send failed. Error: " + e.description);
+ onFailure("FullTab_XMLHttpRequestTest", 1,
+ "Failed to send XHR request");
+ }
+ }
+ </script>
+ </head>
+
+ <body onLoad="setTimeout(ValidateUserAgent, 100);" onkeypress="OnKeyPress()">
+ ChromeFrame full tab mode XMLHttpRequest test. Verifies that
+ XMLHttpRequests use the host network stack.
+ </body>
+</html>