summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 16:23:26 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 16:23:26 +0000
commit057a8d0e726326ccfb80428c9da3dc8902bdf44b (patch)
tree4fa7cc343fdc61d5de908c7575c34ad536f1f279 /chrome_frame
parent5849bc7c3056c81153d5831e6834de15f2567132 (diff)
downloadchromium_src-057a8d0e726326ccfb80428c9da3dc8902bdf44b.zip
chromium_src-057a8d0e726326ccfb80428c9da3dc8902bdf44b.tar.gz
chromium_src-057a8d0e726326ccfb80428c9da3dc8902bdf44b.tar.bz2
Add integration tests for validating the X-UA-Compatible HTTP header code in Chrome Frame.
BUG=22802 TEST=None Review URL: http://codereview.chromium.org/555010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/test/chrome_frame_unittests.cc22
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header.html28
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header.html.mock-http-headers4
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_child_with_header.html29
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_child_with_header.html.mock-http-headers4
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_frameset.html33
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_frameset_child.html29
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_frameset_child.html.mock-http-headers4
-rw-r--r--chrome_frame/test/data/chrome_frame_http_header_host.html37
-rw-r--r--chrome_frame/test/data/chrome_frame_tester_helpers.js4
10 files changed, 192 insertions, 2 deletions
diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc
index 76a41bc..2bf3979 100644
--- a/chrome_frame/test/chrome_frame_unittests.cc
+++ b/chrome_frame/test/chrome_frame_unittests.cc
@@ -578,6 +578,28 @@ TEST_F(ChromeFrameTestWithWebServer, WidgetModeIE_InitializeHidden) {
SimpleBrowserTest(IE, kInitializeHiddenPage, L"InitializeHidden");
}
+const wchar_t kFullTabHttpHeaderPage[] = L"files/chrome_frame_http_header.html";
+
+TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_CFHttpHeaderBasic) {
+ SimpleBrowserTest(IE, kFullTabHttpHeaderPage, L"FullTabHttpHeader");
+}
+
+const wchar_t kFullTabHttpHeaderPageIFrame[] =
+ L"files/chrome_frame_http_header_host.html";
+
+TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_CFHttpHeaderIFrame) {
+ SimpleBrowserTest(IE, kFullTabHttpHeaderPageIFrame,
+ L"FullTabHttpHeaderIFrame");
+}
+
+const wchar_t kFullTabHttpHeaderPageFrameset[] =
+ L"files/chrome_frame_http_header_frameset.html";
+
+TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_CFHttpHeaderFrameSet) {
+ SimpleBrowserTest(IE, kFullTabHttpHeaderPageFrameset,
+ L"FullTabHttpHeaderFrameset");
+}
+
// Flaky on the build bots. See http://crbug.com/30622
TEST_F(ChromeFrameTestWithWebServer, FLAKY_WidgetModeFF_InitializeHidden) {
SimpleBrowserTest(FIREFOX, kInitializeHiddenPage, L"InitializeHidden");
diff --git a/chrome_frame/test/data/chrome_frame_http_header.html b/chrome_frame/test/data/chrome_frame_http_header.html
new file mode 100644
index 0000000..47c2277
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header.html
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+ </head>
+ <body>
+ <div id="statusPanel" style="border: 1px solid red; width: 100%">
+ Test running....
+ </div>
+
+ <script type="text/javascript">
+ var testName = 'FullTabHttpHeader';
+ (function(){
+ try {
+ if (TestIfRunningInChrome()) {
+ onSuccess(testName, 1);
+ } else {
+ onFailure(testName, 1, 'Failed to load in Chrome.');
+ }
+ } catch (e) {
+ onFailure(testName, 1,
+ testName + ' failed with error: ' + e);
+ }
+ })();
+ </script>
+ <p>Tests Chrome Frame full tab mode loading via an HTTP header.</p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_http_header.html.mock-http-headers b/chrome_frame/test/data/chrome_frame_http_header.html.mock-http-headers
new file mode 100644
index 0000000..92779bb
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header.html.mock-http-headers
@@ -0,0 +1,4 @@
+HTTP/1.0 200 OK
+Content-type: text/html
+X-UA-Compatible: chrome=1
+
diff --git a/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html b/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html
new file mode 100644
index 0000000..6693027
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+ </head>
+ <body>
+ <div id="statusPanel" style="border: 1px solid red; width: 100%">
+ Test running....
+ </div>
+
+ <p>This page should not render in Chrome Frame.</p>
+
+ <script type="text/javascript">
+ (function(){
+ var testName = 'FullTabHttpHeaderIFrame';
+ try {
+ if (isRunningInChrome()) {
+ onFailure(testName, 1);
+ } else {
+ parent.reportNotRunningInCF();
+ }
+ } catch (e) {
+ onFailure(testName, 1,
+ testName + ' failed with error: ' + e);
+ }
+ })();
+ </script>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html.mock-http-headers b/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html.mock-http-headers
new file mode 100644
index 0000000..92779bb
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_child_with_header.html.mock-http-headers
@@ -0,0 +1,4 @@
+HTTP/1.0 200 OK
+Content-type: text/html
+X-UA-Compatible: chrome=1
+
diff --git a/chrome_frame/test/data/chrome_frame_http_header_frameset.html b/chrome_frame/test/data/chrome_frame_http_header_frameset.html
new file mode 100644
index 0000000..ae27084
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_frameset.html
@@ -0,0 +1,33 @@
+<html>
+ <head>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+ <script type="text/javascript">
+ var testName = 'FullTabHttpHeaderFrameset';
+
+ // Called by the child document to report success.
+ function reportNotRunningInCF() {
+ onSuccess(testName, 1);
+ }
+ </script>
+ </head>
+ <frameset rows="10%, *">
+ <frame src="about:blank" name="dummy">
+ <frame src="chrome_frame_http_header_frameset_child.html" name="blank">
+ </frameset>
+
+ <script type="text/javascript">
+ var testName = 'FullTabHttpHeaderFrameset';
+ (function(){
+ try {
+ if (isRunningInChrome()) {
+ onFailure(testName, 1);
+ }
+ } catch (e) {
+ onFailure(testName, 1,
+ testName + ' failed with error: ' + e);
+ }
+ })();
+ </script>
+
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html b/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html
new file mode 100644
index 0000000..d16f37b
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+ </head>
+ <body>
+ <div id="statusPanel" style="border: 1px solid red; width: 100%">
+ Test running....
+ </div>
+
+ <p>This page should not render in Chrome Frame.</p>
+
+ <script type="text/javascript">
+ (function(){
+ var testName = 'FullTabHttpHeaderFrameset';
+ try {
+ if (isRunningInChrome()) {
+ onFailure(testName, 1);
+ } else {
+ parent.reportNotRunningInCF();
+ }
+ } catch (e) {
+ onFailure(testName, 1,
+ testName + ' failed with error: ' + e);
+ }
+ })();
+ </script>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html.mock-http-headers b/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html.mock-http-headers
new file mode 100644
index 0000000..92779bb
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_frameset_child.html.mock-http-headers
@@ -0,0 +1,4 @@
+HTTP/1.0 200 OK
+Content-type: text/html
+X-UA-Compatible: chrome=1
+
diff --git a/chrome_frame/test/data/chrome_frame_http_header_host.html b/chrome_frame/test/data/chrome_frame_http_header_host.html
new file mode 100644
index 0000000..d8fee90
--- /dev/null
+++ b/chrome_frame/test/data/chrome_frame_http_header_host.html
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+ <script type="text/javascript">
+ var testName = 'FullTabHttpHeaderIFrame';
+
+ // Called by the child document to report success.
+ function reportNotRunningInCF() {
+ onSuccess(testName, 1);
+ }
+ </script>
+ </head>
+ <body>
+ <div id="statusPanel" style="border: 1px solid red; width: 100%">
+ Test running....
+ </div>
+ <iframe src="chrome_frame_http_header_child_with_header.html"
+ width="200" height="200"></iframe>
+
+ <p>Tests that Chrome Frame does not load in full tab mode when an iframe
+ page is served with the X-UA-Compatible http header.</p>
+ <p>This file loads chrome_frame_http_header_child_with_header.html
+ in an iframe</p>
+
+ <script type="text/javascript">
+ try {
+ if (isRunningInChrome()) {
+ onFailure(testName, 1);
+ }
+ } catch (e) {
+ onFailure(testName, 1,
+ testName + ' failed with error: ' + e);
+ }
+ </script>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_tester_helpers.js b/chrome_frame/test/data/chrome_frame_tester_helpers.js
index 159b00b..f3ccd58 100644
--- a/chrome_frame/test/data/chrome_frame_tester_helpers.js
+++ b/chrome_frame/test/data/chrome_frame_tester_helpers.js
@@ -2,10 +2,12 @@
// This script provides some mechanics for testing ChromeFrame
//
function onSuccess(name, id) {
+ appendStatus("Success reported!");
onFinished(name, id, "OK");
}
function onFailure(name, id, status) {
+ appendStatus("Failure reported: " + status);
onFinished(name, id, status);
}
@@ -84,8 +86,6 @@ function postResult(name, result) {
// Finish running a test by setting the status
// and the cookie.
function onFinished(name, id, result) {
- appendStatus(result);
-
// set a cookie to report the results...
var cookie = name + "." + id + ".status=" + result + "; path=/";
document.cookie = cookie;