OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome_frame/test/test_with_web_server.h" | 5 #include "chrome_frame/test/test_with_web_server.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 BrowserKind browser, const wchar_t* page, const char* result) { | 219 BrowserKind browser, const wchar_t* page, const char* result) { |
220 ASSERT_TRUE(LaunchBrowser(browser, page)); | 220 ASSERT_TRUE(LaunchBrowser(browser, page)); |
221 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), | 221 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), |
222 kPostedResultSubstring); | 222 kPostedResultSubstring); |
223 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); | 223 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); |
224 ASSERT_EQ(result, server_mock_.posted_result()); | 224 ASSERT_EQ(result, server_mock_.posted_result()); |
225 } | 225 } |
226 | 226 |
227 void ChromeFrameTestWithWebServer::SimpleBrowserTest(BrowserKind browser, | 227 void ChromeFrameTestWithWebServer::SimpleBrowserTest(BrowserKind browser, |
228 const wchar_t* page) { | 228 const wchar_t* page) { |
| 229 if (browser == FIREFOX && |
| 230 base::win::GetVersion() == base::win::VERSION_WIN7) { |
| 231 LOG(INFO) << "Not running Firefox tests on Windows 7"; |
| 232 return; |
| 233 } |
229 SimpleBrowserTestExpectedResult(browser, page, "OK"); | 234 SimpleBrowserTestExpectedResult(browser, page, "OK"); |
230 } | 235 } |
231 | 236 |
232 void ChromeFrameTestWithWebServer::OptionalBrowserTest(BrowserKind browser, | 237 void ChromeFrameTestWithWebServer::OptionalBrowserTest(BrowserKind browser, |
233 const wchar_t* page) { | 238 const wchar_t* page) { |
234 DCHECK(browser != CHROME) << "Chrome tests shouldn't be optional"; | 239 DCHECK(browser != CHROME) << "Chrome tests shouldn't be optional"; |
235 if (!LaunchBrowser(browser, page)) { | 240 if (!LaunchBrowser(browser, page)) { |
236 LOG(ERROR) << "Failed to launch browser " << ToString(browser); | 241 LOG(ERROR) << "Failed to launch browser " << ToString(browser); |
237 } else { | 242 } else { |
238 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), | 243 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), |
239 kPostedResultSubstring); | 244 kPostedResultSubstring); |
240 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); | 245 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); |
241 ASSERT_EQ("OK", server_mock_.posted_result()); | 246 ASSERT_EQ("OK", server_mock_.posted_result()); |
242 } | 247 } |
243 } | 248 } |
244 | 249 |
245 void ChromeFrameTestWithWebServer::VersionTest(BrowserKind browser, | 250 void ChromeFrameTestWithWebServer::VersionTest(BrowserKind browser, |
246 const wchar_t* page) { | 251 const wchar_t* page) { |
| 252 if (browser == FIREFOX && |
| 253 base::win::GetVersion() == base::win::VERSION_WIN7) { |
| 254 LOG(INFO) << "Not running Firefox tests on Windows 7"; |
| 255 return; |
| 256 } |
| 257 |
247 FilePath plugin_path; | 258 FilePath plugin_path; |
248 PathService::Get(base::DIR_MODULE, &plugin_path); | 259 PathService::Get(base::DIR_MODULE, &plugin_path); |
249 plugin_path = plugin_path.AppendASCII("servers"); | 260 plugin_path = plugin_path.AppendASCII("servers"); |
250 plugin_path = plugin_path.Append(kChromeFrameDllName); | 261 plugin_path = plugin_path.Append(kChromeFrameDllName); |
251 | 262 |
252 static FileVersionInfo* version_info = | 263 static FileVersionInfo* version_info = |
253 FileVersionInfo::CreateFileVersionInfo(plugin_path); | 264 FileVersionInfo::CreateFileVersionInfo(plugin_path); |
254 | 265 |
255 std::wstring version; | 266 std::wstring version; |
256 if (version_info) | 267 if (version_info) |
(...skipping 27 matching lines...) Expand all Loading... |
284 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), | 295 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), |
285 kPostedResultSubstring); | 296 kPostedResultSubstring); |
286 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); | 297 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); |
287 ASSERT_EQ(version, UTF8ToWide(server_mock_.posted_result())); | 298 ASSERT_EQ(version, UTF8ToWide(server_mock_.posted_result())); |
288 } | 299 } |
289 | 300 |
290 void ChromeFrameTestWithWebServer::SessionIdTest(BrowserKind browser, | 301 void ChromeFrameTestWithWebServer::SessionIdTest(BrowserKind browser, |
291 const wchar_t* page, | 302 const wchar_t* page, |
292 int privilege_mode, | 303 int privilege_mode, |
293 const char* expected_result) { | 304 const char* expected_result) { |
| 305 if (browser == FIREFOX && |
| 306 base::win::GetVersion() == base::win::VERSION_WIN7) { |
| 307 LOG(INFO) << "Not running Firefox tests on Windows 7"; |
| 308 return; |
| 309 } |
| 310 |
294 SetConfigInt(kEnableFirefoxPrivilegeMode, privilege_mode); | 311 SetConfigInt(kEnableFirefoxPrivilegeMode, privilege_mode); |
295 EXPECT_TRUE(LaunchBrowser(browser, page)); | 312 EXPECT_TRUE(LaunchBrowser(browser, page)); |
296 server_mock_.set_expected_result(expected_result); | 313 server_mock_.set_expected_result(expected_result); |
297 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), | 314 server_mock_.ExpectAndHandlePostedResult(CFInvocation(CFInvocation::NONE), |
298 kPostedResultSubstring); | 315 kPostedResultSubstring); |
299 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); | 316 WaitForTestToComplete(TestTimeouts::action_max_timeout_ms()); |
300 ASSERT_EQ(expected_result, server_mock_.posted_result()); | 317 ASSERT_EQ(expected_result, server_mock_.posted_result()); |
301 } | 318 } |
302 | 319 |
303 // MockWebServer methods | 320 // MockWebServer methods |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1062 } |
1046 | 1063 |
1047 const wchar_t kWindowCloseTestUrl[] = | 1064 const wchar_t kWindowCloseTestUrl[] = |
1048 L"window_close.html"; | 1065 L"window_close.html"; |
1049 | 1066 |
1050 TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_WindowClose) { | 1067 TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_WindowClose) { |
1051 SimpleBrowserTest(IE, kWindowCloseTestUrl); | 1068 SimpleBrowserTest(IE, kWindowCloseTestUrl); |
1052 } | 1069 } |
1053 | 1070 |
1054 TEST_F(ChromeFrameTestWithWebServer, FullTabModeFF_WindowClose) { | 1071 TEST_F(ChromeFrameTestWithWebServer, FullTabModeFF_WindowClose) { |
1055 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 | |
1056 // for more information on why this test is disabled for Vista with IE7. | |
1057 if (base::win::GetVersion() == base::win::VERSION_VISTA && | |
1058 chrome_frame_test::GetInstalledIEVersion() == IE_7) { | |
1059 LOG(INFO) << "Not running test on Vista with IE7"; | |
1060 return; | |
1061 } | |
1062 SimpleBrowserTest(FIREFOX, kWindowCloseTestUrl); | 1072 SimpleBrowserTest(FIREFOX, kWindowCloseTestUrl); |
1063 } | 1073 } |
1064 | 1074 |
1065 std::string GetHeaderValue(const std::string& headers, | 1075 std::string GetHeaderValue(const std::string& headers, |
1066 const char* header_name) { | 1076 const char* header_name) { |
1067 net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), | 1077 net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), |
1068 "\r\n"); | 1078 "\r\n"); |
1069 while (it.GetNext()) { | 1079 while (it.GetNext()) { |
1070 if (lstrcmpiA(it.name().c_str(), header_name) == 0) { | 1080 if (lstrcmpiA(it.name().c_str(), header_name) == 0) { |
1071 return it.values(); | 1081 return it.values(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 server.web_server()->AddResponse(response); | 1292 server.web_server()->AddResponse(response); |
1283 | 1293 |
1284 std::wstring url(server.FormatHttpPath(L"form.html")); | 1294 std::wstring url(server.FormatHttpPath(L"form.html")); |
1285 | 1295 |
1286 ASSERT_TRUE(LaunchBrowser(IE, url.c_str())); | 1296 ASSERT_TRUE(LaunchBrowser(IE, url.c_str())); |
1287 loop_.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); | 1297 loop_.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); |
1288 | 1298 |
1289 EXPECT_EQ(1, response->get_request_count()); | 1299 EXPECT_EQ(1, response->get_request_count()); |
1290 EXPECT_EQ(1, response->post_request_count()); | 1300 EXPECT_EQ(1, response->post_request_count()); |
1291 } | 1301 } |
OLD | NEW |