OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_util.h" | 8 #include "base/file_util.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ss << "X-UA-Compatible: chrome=1\r\n"; | 51 ss << "X-UA-Compatible: chrome=1\r\n"; |
52 if (add_no_cache_header) { | 52 if (add_no_cache_header) { |
53 ss << "Cache-Control: no-cache\r\n"; | 53 ss << "Cache-Control: no-cache\r\n"; |
54 ss << "Expires: Tue, 15 Nov 1994 08:12:31 GMT\r\n"; | 54 ss << "Expires: Tue, 15 Nov 1994 08:12:31 GMT\r\n"; |
55 } | 55 } |
56 return ss.str(); | 56 return ss.str(); |
57 } | 57 } |
58 | 58 |
59 std::string GetMockHttpHeaders(const base::FilePath& mock_http_headers_path) { | 59 std::string GetMockHttpHeaders(const base::FilePath& mock_http_headers_path) { |
60 std::string headers; | 60 std::string headers; |
61 file_util::ReadFileToString(mock_http_headers_path, &headers); | 61 base::ReadFileToString(mock_http_headers_path, &headers); |
62 return headers; | 62 return headers; |
63 } | 63 } |
64 | 64 |
65 class ChromeFrameTestEnvironment: public testing::Environment { | 65 class ChromeFrameTestEnvironment: public testing::Environment { |
66 public: | 66 public: |
67 virtual ~ChromeFrameTestEnvironment() {} | 67 virtual ~ChromeFrameTestEnvironment() {} |
68 virtual void SetUp() OVERRIDE { | 68 virtual void SetUp() OVERRIDE { |
69 ScopedChromeFrameRegistrar::RegisterDefaults(); | 69 ScopedChromeFrameRegistrar::RegisterDefaults(); |
70 } | 70 } |
71 }; | 71 }; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } else { | 410 } else { |
411 EXPECT_TRUE(net::GetMimeTypeFromFile(file_path, &content_type)); | 411 EXPECT_TRUE(net::GetMimeTypeFromFile(file_path, &content_type)); |
412 VLOG(1) << "Going to send file (" << WideToUTF8(file_path.value()) | 412 VLOG(1) << "Going to send file (" << WideToUTF8(file_path.value()) |
413 << ") with content type (" << content_type << ")"; | 413 << ") with content type (" << content_type << ")"; |
414 headers = CreateHttpHeaders(invocation, add_no_cache_header, | 414 headers = CreateHttpHeaders(invocation, add_no_cache_header, |
415 content_type); | 415 content_type); |
416 } | 416 } |
417 | 417 |
418 EXPECT_FALSE(headers.empty()); | 418 EXPECT_FALSE(headers.empty()); |
419 | 419 |
420 EXPECT_TRUE(file_util::ReadFileToString(file_path, &body)) | 420 EXPECT_TRUE(base::ReadFileToString(file_path, &body)) |
421 << "Could not read file (" << WideToUTF8(file_path.value()) << ")"; | 421 << "Could not read file (" << WideToUTF8(file_path.value()) << ")"; |
422 if (invocation.type() == CFInvocation::META_TAG && | 422 if (invocation.type() == CFInvocation::META_TAG && |
423 StartsWithASCII(content_type, "text/html", false)) { | 423 StartsWithASCII(content_type, "text/html", false)) { |
424 EXPECT_TRUE(chrome_frame_test::AddCFMetaTag(&body)) << "Could not add " | 424 EXPECT_TRUE(chrome_frame_test::AddCFMetaTag(&body)) << "Could not add " |
425 << "meta tag to HTML file."; | 425 << "meta tag to HTML file."; |
426 } | 426 } |
427 } else { | 427 } else { |
428 VLOG(1) << "Going to send 404 for non-existent file (" | 428 VLOG(1) << "Going to send 404 for non-existent file (" |
429 << WideToUTF8(file_path.value()) << ")"; | 429 << WideToUTF8(file_path.value()) << ")"; |
430 headers = "HTTP/1.1 404 Not Found"; | 430 headers = "HTTP/1.1 404 Not Found"; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // This test loads a large page and ensures that the full page contents are | 1091 // This test loads a large page and ensures that the full page contents are |
1092 // actually loaded via a self-validating HTML page. This is done due to a bug | 1092 // actually loaded via a self-validating HTML page. This is done due to a bug |
1093 // whereby the middle of the response stream would sometimes be truncated when | 1093 // whereby the middle of the response stream would sometimes be truncated when |
1094 // loading a CF document. See http://crbug.com/178421 for details. | 1094 // loading a CF document. See http://crbug.com/178421 for details. |
1095 TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_LargePageLoad) { | 1095 TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_LargePageLoad) { |
1096 const wchar_t kLargePageLoadPage[] = | 1096 const wchar_t kLargePageLoadPage[] = |
1097 L"chrome_frame_large_page.html"; | 1097 L"chrome_frame_large_page.html"; |
1098 | 1098 |
1099 SimpleBrowserTest(IE, kLargePageLoadPage); | 1099 SimpleBrowserTest(IE, kLargePageLoadPage); |
1100 } | 1100 } |
OLD | NEW |