summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-17 18:58:55 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-17 18:58:55 +0000
commit483a075709bb435ddf380aac050dc3b7a586d244 (patch)
tree950a196f2d8da8c53072e762dc5793cb99ec0125 /chrome_frame/test
parent3ddb236464c9c37be85d3856362f536a20b53b99 (diff)
downloadchromium_src-483a075709bb435ddf380aac050dc3b7a586d244.zip
chromium_src-483a075709bb435ddf380aac050dc3b7a586d244.tar.gz
chromium_src-483a075709bb435ddf380aac050dc3b7a586d244.tar.bz2
Incorporating review comments from Amit. The keyboard based back forward test only needs simple HTML
files with the meta tag to switch to Chrome. Removed the fulltab_forward_page.html amd fulltab_back_page.html and replaced them with the sub_frame1.html and sub_frame2.html Other changes include to use SetFocusToChrome helper function to give focus to the Chrome renderer window instead of sending a WM_LBUTTONDOWN and to use ComStackObjectWithUninitialize mock class to ensure that things get cleaned up correctly. Review URL: http://codereview.chromium.org/608033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.cc4
-rw-r--r--chrome_frame/test/data/fulltab_back_page.html16
-rw-r--r--chrome_frame/test/data/fulltab_forward_page.html16
-rw-r--r--chrome_frame/test/test_mock_with_web_server.cc55
4 files changed, 30 insertions, 61 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index 04e1597..2db3783 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -750,12 +750,12 @@ void WebBrowserEventSink::Exec(const GUID* cmd_group_guid, DWORD command_id,
}
void WebBrowserEventSink::NavigateBackward() {
- SendMouseClick(10, 10, simulate_input::LEFT);
+ SetFocusToChrome();
simulate_input::SendMnemonic(VK_BACK, false, false, false, false, false);
}
void WebBrowserEventSink::NavigateForward() {
- SendMouseClick(10, 10, simulate_input::LEFT);
+ SetFocusToChrome();
simulate_input::SendMnemonic(VK_BACK, true, false, false, false, false);
}
diff --git a/chrome_frame/test/data/fulltab_back_page.html b/chrome_frame/test/data/fulltab_back_page.html
deleted file mode 100644
index fe0ab97..0000000
--- a/chrome_frame/test/data/fulltab_back_page.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
- <head>
- <meta http-equiv="x-ua-compatible" content="chrome=1" />
- <title>ChromeFrame fulltab Esc keystroke back page</title>
- <script language=javascript>
- function onLoad() {
- // Onload handling goes here.
- }
- </script>
- </head>
-
- <body onload="onLoad();">
- ChromeFrame full tab mode Esc keystroke back page.
- Verifies whether the Esc keystroke navigates backwards in ChromeFrame.
- </body>
-</html>
diff --git a/chrome_frame/test/data/fulltab_forward_page.html b/chrome_frame/test/data/fulltab_forward_page.html
deleted file mode 100644
index 2f8e2e2..0000000
--- a/chrome_frame/test/data/fulltab_forward_page.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
- <head>
- <meta http-equiv="x-ua-compatible" content="chrome=1" />
- <title>ChromeFrame fulltab Shift-Esc keystroke forward page</title>
- <script language=javascript>
- function onLoad() {
- // onload handling goes here.
- }
- </script>
- </head>
-
- <body onload="onLoad();">
- ChromeFrame full tab mode Shift-Esc keystroke forward page.
- Verifies whether the Shift-Esc keystroke navigates forward in ChromeFrame.
- </body>
-</html>
diff --git a/chrome_frame/test/test_mock_with_web_server.cc b/chrome_frame/test/test_mock_with_web_server.cc
index 70495e9..d040bda 100644
--- a/chrome_frame/test/test_mock_with_web_server.cc
+++ b/chrome_frame/test/test_mock_with_web_server.cc
@@ -1217,67 +1217,67 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_ContextMenuViewSource) {
loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
}
-const wchar_t kKeyboardTestForwardUrl[] =
- L"http://localhost:1337/files/fulltab_forward_page.html";
-
-const wchar_t kKeyboardTestBackUrl[] =
- L"http://localhost:1337/files/fulltab_back_page.html";
-
TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_KeyboardBackForwardTest) {
chrome_frame_test::TimedMsgLoop loop;
- CComObjectStackEx<MockWebBrowserEventSink> mock;
- CComObjectStackEx<MockWebBrowserEventSink> view_source_mock;
+ ComStackObjectWithUninitialize<MockWebBrowserEventSink> mock;
+
+ EXPECT_CALL(mock, OnFileDownload(VARIANT_TRUE, _))
+ .Times(testing::AnyNumber()).WillRepeatedly(testing::Return());
+
::testing::InSequence sequence; // Everything in sequence
// This test performs the following steps.
// 1. Launches IE and navigates to
- // http://localhost:1337/files/fulltab_back_page.html
+ // http://localhost:1337/files/sub_frame1.html
// 2. It then navigates to
- // http://localhost:1337/files/fulltab_back_page.html
+ // http://localhost:1337/files/sub_frame2.html
// 3. Sends the VK_BACK keystroke to IE, which should navigate back to
- // http://localhost:1337/files/fulltab_back_page.html
+ // http://localhost:1337/files/sub_frame1.html
// 4. Sends the Shift + VK_BACK keystroke to IE which should navigate
- // forward to http://localhost:1337/files/fulltab_forward_page.html
+ // forward to http://localhost:1337/files/sub_frame2.html
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestBackUrl)),
+ testing::StrCaseEq(kSubFrameUrl1)),
_, _, _, _, _))
.WillOnce(testing::Return(S_OK));
+
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.WillOnce(testing::Return());
+
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestBackUrl)),
+ testing::StrCaseEq(kSubFrameUrl1)),
_, _, _, _, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return(S_OK));
+
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return());
VARIANT empty = ScopedVariant::kEmptyVariant;
- EXPECT_CALL(mock, OnLoad(testing::StrEq(kKeyboardTestBackUrl)))
+ EXPECT_CALL(mock, OnLoad(testing::StrEq(kSubFrameUrl1)))
.WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(
CreateFunctor(
&mock, &chrome_frame_test::WebBrowserEventSink::Navigate,
- std::wstring(kKeyboardTestForwardUrl)))));
+ std::wstring(kSubFrameUrl2)))));
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestForwardUrl)),
+ testing::StrCaseEq(kSubFrameUrl2)),
_, _, _, _, _))
.WillOnce(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.WillOnce(testing::Return());
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestForwardUrl)),
+ testing::StrCaseEq(kSubFrameUrl2)),
_, _, _, _, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return());
- EXPECT_CALL(mock, OnLoad(testing::StrEq(kKeyboardTestForwardUrl)))
+ EXPECT_CALL(mock, OnLoad(testing::StrEq(kSubFrameUrl2)))
.WillOnce(testing::InvokeWithoutArgs(CreateFunctor(&loop,
&chrome_frame_test::TimedMsgLoop::PostDelayedTask, FROM_HERE,
NewRunnableMethod(
@@ -1286,20 +1286,20 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_KeyboardBackForwardTest) {
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestBackUrl)),
+ testing::StrCaseEq(kSubFrameUrl1)),
_, _, _, _, _))
.WillOnce(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.WillOnce(testing::Return());
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestBackUrl)),
+ testing::StrCaseEq(kSubFrameUrl1)),
_, _, _, _, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return());
- EXPECT_CALL(mock, OnLoad(testing::StrEq(kKeyboardTestBackUrl)))
+ EXPECT_CALL(mock, OnLoad(testing::StrEq(kSubFrameUrl1)))
.WillOnce(testing::InvokeWithoutArgs(CreateFunctor(&loop,
&chrome_frame_test::TimedMsgLoop::PostDelayedTask, FROM_HERE,
NewRunnableMethod(
@@ -1308,31 +1308,32 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_KeyboardBackForwardTest) {
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestForwardUrl)),
+ testing::StrCaseEq(kSubFrameUrl2)),
_, _, _, _, _))
.WillOnce(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.WillOnce(testing::Return());
EXPECT_CALL(mock,
OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
- testing::StrCaseEq(kKeyboardTestForwardUrl)),
+ testing::StrCaseEq(kSubFrameUrl2)),
_, _, _, _, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return(S_OK));
EXPECT_CALL(mock, OnNavigateComplete2(_, _))
.Times(testing::AnyNumber()).WillRepeatedly(testing::Return());
- EXPECT_CALL(mock, OnLoad(testing::StrEq(kKeyboardTestForwardUrl)))
+ EXPECT_CALL(mock, OnLoad(testing::StrEq(kSubFrameUrl2)))
.Times(1)
.WillOnce(QUIT_LOOP_SOON(loop, 2));
- HRESULT hr = mock.LaunchIEAndNavigate(kKeyboardTestBackUrl);
+ EXPECT_CALL(mock, OnQuit()).WillOnce(testing::Return());
+
+ HRESULT hr = mock.LaunchIEAndNavigate(kSubFrameUrl1);
ASSERT_HRESULT_SUCCEEDED(hr);
if (hr == S_FALSE)
return;
ASSERT_TRUE(mock.web_browser2() != NULL);
loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
- mock.Uninitialize();
chrome_frame_test::CloseAllIEWindows();
}