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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 std::string headers, body; | 347 std::string headers, body; |
348 std::string content_type; | 348 std::string content_type; |
349 if (file_util::PathExists(file_path)) { | 349 if (file_util::PathExists(file_path)) { |
350 FilePath mock_http_headers(file_path.value() + L".mock-http-headers"); | 350 FilePath mock_http_headers(file_path.value() + L".mock-http-headers"); |
351 if (file_util::PathExists(mock_http_headers)) { | 351 if (file_util::PathExists(mock_http_headers)) { |
352 headers = GetMockHttpHeaders(mock_http_headers); | 352 headers = GetMockHttpHeaders(mock_http_headers); |
353 content_type = http_utils::GetHttpHeaderFromHeaderList("Content-type", | 353 content_type = http_utils::GetHttpHeaderFromHeaderList("Content-type", |
354 headers); | 354 headers); |
355 } else { | 355 } else { |
356 EXPECT_TRUE(net::GetMimeTypeFromFile(file_path, &content_type)); | 356 EXPECT_TRUE(net::GetMimeTypeFromFile(file_path, &content_type)); |
357 DLOG(INFO) << "Going to send file (" << WideToUTF8(file_path.value()) | 357 DVLOG(1) << "Going to send file (" << WideToUTF8(file_path.value()) |
358 << ") with content type (" << content_type << ")"; | 358 << ") with content type (" << content_type << ")"; |
359 headers = CreateHttpHeaders(invocation, add_no_cache_header, | 359 headers = CreateHttpHeaders(invocation, add_no_cache_header, |
360 content_type); | 360 content_type); |
361 } | 361 } |
362 | 362 |
363 EXPECT_FALSE(headers.empty()); | 363 EXPECT_FALSE(headers.empty()); |
364 | 364 |
365 EXPECT_TRUE(file_util::ReadFileToString(file_path, &body)) | 365 EXPECT_TRUE(file_util::ReadFileToString(file_path, &body)) |
366 << "Could not read file (" << WideToUTF8(file_path.value()) << ")"; | 366 << "Could not read file (" << WideToUTF8(file_path.value()) << ")"; |
367 if (invocation.type() == CFInvocation::META_TAG && | 367 if (invocation.type() == CFInvocation::META_TAG && |
368 StartsWithASCII(content_type, "text/html", false)) { | 368 StartsWithASCII(content_type, "text/html", false)) { |
369 EXPECT_TRUE(chrome_frame_test::AddCFMetaTag(&body)) << "Could not add " | 369 EXPECT_TRUE(chrome_frame_test::AddCFMetaTag(&body)) << "Could not add " |
370 << "meta tag to HTML file."; | 370 << "meta tag to HTML file."; |
371 } | 371 } |
372 } else { | 372 } else { |
373 DLOG(INFO) << "Going to send 404 for non-existent file (" | 373 DVLOG(1) << "Going to send 404 for non-existent file (" |
374 << WideToUTF8(file_path.value()) << ")"; | 374 << WideToUTF8(file_path.value()) << ")"; |
375 headers = "HTTP/1.1 404 Not Found"; | 375 headers = "HTTP/1.1 404 Not Found"; |
376 body = ""; | 376 body = ""; |
377 } | 377 } |
378 connection->Send(headers, body); | 378 connection->Send(headers, body); |
379 } | 379 } |
380 | 380 |
381 const wchar_t kPostMessageBasicPage[] = L"postmessage_basic_host.html"; | 381 const wchar_t kPostMessageBasicPage[] = L"postmessage_basic_host.html"; |
382 | 382 |
383 TEST_F(ChromeFrameTestWithWebServer, WidgetModeIE_PostMessageBasic) { | 383 TEST_F(ChromeFrameTestWithWebServer, WidgetModeIE_PostMessageBasic) { |
384 SimpleBrowserTest(IE, kPostMessageBasicPage); | 384 SimpleBrowserTest(IE, kPostMessageBasicPage); |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 const test_server::Request& r = c->request(); | 1109 const test_server::Request& r = c->request(); |
1110 if (ASCIIToWide(r.path().substr(1)).compare(kPages[0]) == 0) { | 1110 if (ASCIIToWide(r.path().substr(1)).compare(kPages[0]) == 0) { |
1111 requests_for_first_page++; | 1111 requests_for_first_page++; |
1112 std::string ua(GetHeaderValue(r.headers(), "User-Agent")); | 1112 std::string ua(GetHeaderValue(r.headers(), "User-Agent")); |
1113 EXPECT_NE(std::string::npos, ua.find("chromeframe")); | 1113 EXPECT_NE(std::string::npos, ua.find("chromeframe")); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 EXPECT_GT(requests_for_first_page, 1); | 1116 EXPECT_GT(requests_for_first_page, 1); |
1117 } | 1117 } |
1118 | 1118 |
OLD | NEW |