diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 01:14:45 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 01:14:45 +0000 |
commit | c9555c02cfaa69a50eff610edad10bbab938976a (patch) | |
tree | a58159189529a195f808da586683dfe8a95893e8 /chrome_frame/test | |
parent | aca3e9b6ab27f5606b8b4ad6fcc27f0f0bc91f6e (diff) | |
download | chromium_src-c9555c02cfaa69a50eff610edad10bbab938976a.zip chromium_src-c9555c02cfaa69a50eff610edad10bbab938976a.tar.gz chromium_src-c9555c02cfaa69a50eff610edad10bbab938976a.tar.bz2 |
Don't switch to CF's active document for frames or iframes.This fixes an issue where a page that uses CF would be loaded in an IFRAME on Google Images.Instead of attempting to load CF (not supported), we now defer to the host browser. Previously a blank page was displayed.TEST=Run new unit tests: FullTabModeIE_SubIFrame and FullTabModeIE_SubFrameBUG=22989
Review URL: http://codereview.chromium.org/343086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/chrome_frame_unittests.cc | 19 | ||||
-rw-r--r-- | chrome_frame/test/data/chrome_frame_tester_helpers.js | 13 | ||||
-rw-r--r-- | chrome_frame/test/data/full_tab_sub_frame1.html | 26 | ||||
-rw-r--r-- | chrome_frame/test/data/full_tab_sub_frame2.html | 21 | ||||
-rw-r--r-- | chrome_frame/test/data/full_tab_sub_frame_main.html | 6 | ||||
-rw-r--r-- | chrome_frame/test/data/full_tab_sub_iframe_main.html | 30 |
6 files changed, 107 insertions, 8 deletions
diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc index 3b3035f..0964796 100644 --- a/chrome_frame/test/chrome_frame_unittests.cc +++ b/chrome_frame/test/chrome_frame_unittests.cc @@ -1281,6 +1281,16 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_ReferrerTest) { SimpleBrowserTest(IE, kReferrerMainTest, L"FullTab_ReferrerTest"); } +const wchar_t kSubFrameTestPage[] = L"files/full_tab_sub_frame_main.html"; +TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_SubFrame) { + SimpleBrowserTest(IE, kSubFrameTestPage, L"sub_frame"); +} + +const wchar_t kSubIFrameTestPage[] = L"files/full_tab_sub_iframe_main.html"; +TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_SubIFrame) { + SimpleBrowserTest(IE, kSubIFrameTestPage, L"sub_frame"); +} + HRESULT LaunchIEAsComServer(IWebBrowser2** web_browser) { if (!web_browser) return E_INVALIDARG; @@ -1340,7 +1350,7 @@ class MockWebBrowserEventSink : public WebBrowserEventSink { } MOCK_METHOD7_WITH_CALLTYPE(__stdcall, OnBeforeNavigate2, - HRESULT (IDispatch* dispatch, + HRESULT (IDispatch* dispatch, // NOLINT VARIANT* url, VARIANT* flags, VARIANT* target_frame_name, @@ -1349,17 +1359,18 @@ class MockWebBrowserEventSink : public WebBrowserEventSink { VARIANT_BOOL* cancel)); MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnNavigateComplete2, - void (IDispatch* dispatch, VARIANT* url)); + void (IDispatch* dispatch, // NOLINT + VARIANT* url)); MOCK_METHOD5_WITH_CALLTYPE(__stdcall, OnNewWindow3, - void (IDispatch** dispatch, + void (IDispatch** dispatch, // NOLINT VARIANT_BOOL* Cancel, DWORD flags, BSTR url_context, BSTR url)); MOCK_METHOD5_WITH_CALLTYPE(__stdcall, OnNavigateError, - void (IDispatch* dispatch, + void (IDispatch* dispatch, // NOLINT VARIANT* url, VARIANT* frame_name, VARIANT* status_code, diff --git a/chrome_frame/test/data/chrome_frame_tester_helpers.js b/chrome_frame/test/data/chrome_frame_tester_helpers.js index 67df52a..e18ab87 100644 --- a/chrome_frame/test/data/chrome_frame_tester_helpers.js +++ b/chrome_frame/test/data/chrome_frame_tester_helpers.js @@ -17,10 +17,10 @@ function getXHRObject(){ http = new XMLHttpRequest(); } catch(e) { } - + if (http) return http; - + for (var i = 0; i < 3; ++i) { var progid = XMLHTTP_PROGIDS[i]; try { @@ -140,11 +140,16 @@ function reloadUsingCFProtocol() { window.location = redirect_location; } -function TestIfRunningInChrome() { +function isRunningInChrome() { var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase()); + return is_chrome; +} + +function TestIfRunningInChrome() { + var is_chrome = isRunningInChrome(); if (!is_chrome) { onFailure("ChromeFrameWindowOpen", "Window Open failed :-(", - "User agent = " + navigator.userAgent.toLowerCase()); + "User agent = " + navigator.userAgent.toLowerCase()); } return is_chrome; } diff --git a/chrome_frame/test/data/full_tab_sub_frame1.html b/chrome_frame/test/data/full_tab_sub_frame1.html new file mode 100644 index 0000000..7deb946 --- /dev/null +++ b/chrome_frame/test/data/full_tab_sub_frame1.html @@ -0,0 +1,26 @@ +<html> + <head> + <meta http-equiv="x-ua-compatible" content="chrome=1" /> + <!-- the http-equiv tag should be ignored since we're in a sub frame --> + <title>ChromeFrame Sub Frame test</title> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + + <script type="text/javascript"> + function OnLoad() { + if (isRunningInChrome()) { + onFailure("sub_frame", 1, 'Failed'); + } else { + onSuccess("sub_frame", 1); + } + } + </script> + </head> + + <body onLoad="OnLoad();"> + ChromeFrame full tab mode sub frame test. Verifies that frame pages are + not opened in CF even though they have the meta tag.<br> + This frame has the x-ua-compatible http-equiv tag, but should not be + loaded in CF since it's inside a frame. + </body> +</html> diff --git a/chrome_frame/test/data/full_tab_sub_frame2.html b/chrome_frame/test/data/full_tab_sub_frame2.html new file mode 100644 index 0000000..a288f2f --- /dev/null +++ b/chrome_frame/test/data/full_tab_sub_frame2.html @@ -0,0 +1,21 @@ +<html> + <head> + <!-- no meta tag here --> + <title>ChromeFrame Sub Frame test</title> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + + <script type="text/javascript"> + function OnLoad() { + if (isRunningInChrome()) { + onFailure("sub_frame", 1, "Failed"); + } + } + </script> + </head> + + <body onLoad="OnLoad();"> + ChromeFrame full tab mode sub frame test.<br> + This is a regular frame (no meta tag). + </body> +</html> diff --git a/chrome_frame/test/data/full_tab_sub_frame_main.html b/chrome_frame/test/data/full_tab_sub_frame_main.html new file mode 100644 index 0000000..6cf0102 --- /dev/null +++ b/chrome_frame/test/data/full_tab_sub_frame_main.html @@ -0,0 +1,6 @@ +<html> +<frameset cols="50%,*"> + <frame src="full_tab_sub_frame1.html" /> + <frame src="full_tab_sub_frame2.html" /> +</frameset> +</html>
\ No newline at end of file diff --git a/chrome_frame/test/data/full_tab_sub_iframe_main.html b/chrome_frame/test/data/full_tab_sub_iframe_main.html new file mode 100644 index 0000000..20050db --- /dev/null +++ b/chrome_frame/test/data/full_tab_sub_iframe_main.html @@ -0,0 +1,30 @@ +<html> + <head> + <title>ChromeFrame full tab IFRAME test main</title> + </head> +<body> +<table height="100%" width="100%"> + <tr height="1%"> + <td style="top:0;width:100%"> + <table width="100%"> + <tr> + <td> + Placeholder text. + <td align=right valign=bottom> + I slappa da bass! + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <iframe scrolling=auto src="full_tab_sub_frame1.html" + frameborder=1 allowtransparency=true + style="width:100%;height:100%"> + </iframe> + </td> + </tr> +</table> +</body> +</html> |