| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <atlsecurity.h> | 6 #include <atlsecurity.h> |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "webkit/user_agent/user_agent_util.h" | 27 #include "webkit/user_agent/user_agent_util.h" |
| 28 | 28 |
| 29 const char kChromeFrameUserAgent[] = "chromeframe"; | 29 const char kChromeFrameUserAgent[] = "chromeframe"; |
| 30 | 30 |
| 31 class HtmlUtilUnittest : public testing::Test { | 31 class HtmlUtilUnittest : public testing::Test { |
| 32 protected: | 32 protected: |
| 33 // Constructor | 33 // Constructor |
| 34 HtmlUtilUnittest() {} | 34 HtmlUtilUnittest() {} |
| 35 | 35 |
| 36 // Returns the test path given a test case. | 36 // Returns the test path given a test case. |
| 37 virtual bool GetTestPath(const std::string& test_case, FilePath* path) { | 37 virtual bool GetTestPath(const std::string& test_case, base::FilePath* path) { |
| 38 if (!path) { | 38 if (!path) { |
| 39 NOTREACHED(); | 39 NOTREACHED(); |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 FilePath test_path; | 43 base::FilePath test_path; |
| 44 if (!PathService::Get(base::DIR_SOURCE_ROOT, &test_path)) { | 44 if (!PathService::Get(base::DIR_SOURCE_ROOT, &test_path)) { |
| 45 NOTREACHED(); | 45 NOTREACHED(); |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 test_path = test_path.AppendASCII("chrome_frame"); | 49 test_path = test_path.AppendASCII("chrome_frame"); |
| 50 test_path = test_path.AppendASCII("test"); | 50 test_path = test_path.AppendASCII("test"); |
| 51 test_path = test_path.AppendASCII("html_util_test_data"); | 51 test_path = test_path.AppendASCII("html_util_test_data"); |
| 52 test_path = test_path.AppendASCII(test_case); | 52 test_path = test_path.AppendASCII(test_case); |
| 53 | 53 |
| 54 *path = test_path; | 54 *path = test_path; |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual bool GetTestData(const std::string& test_case, std::wstring* data) { | 58 virtual bool GetTestData(const std::string& test_case, std::wstring* data) { |
| 59 if (!data) { | 59 if (!data) { |
| 60 NOTREACHED(); | 60 NOTREACHED(); |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 FilePath path; | 64 base::FilePath path; |
| 65 if (!GetTestPath(test_case, &path)) { | 65 if (!GetTestPath(test_case, &path)) { |
| 66 NOTREACHED(); | 66 NOTREACHED(); |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 std::string raw_data; | 70 std::string raw_data; |
| 71 file_util::ReadFileToString(path, &raw_data); | 71 file_util::ReadFileToString(path, &raw_data); |
| 72 | 72 |
| 73 // Convert to wide using the "best effort" assurance described in | 73 // Convert to wide using the "best effort" assurance described in |
| 74 // string_util.h | 74 // string_util.h |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 "Content-Length: 42\r\n" | 495 "Content-Length: 42\r\n" |
| 496 "X-Frame-Options: SAMEORIGIN\r\n")); | 496 "X-Frame-Options: SAMEORIGIN\r\n")); |
| 497 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 497 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
| 498 "X-Frame-Options: deny\r\n" | 498 "X-Frame-Options: deny\r\n" |
| 499 "X-Frame-Options: ALLOWall\r\n" | 499 "X-Frame-Options: ALLOWall\r\n" |
| 500 "Content-Length: 42\r\n")); | 500 "Content-Length: 42\r\n")); |
| 501 EXPECT_TRUE(http_utils::HasFrameBustingHeader( | 501 EXPECT_TRUE(http_utils::HasFrameBustingHeader( |
| 502 "X-Frame-Options: SAMEORIGIN\r\n" | 502 "X-Frame-Options: SAMEORIGIN\r\n" |
| 503 "X-Frame-Options: ALLOWall\r\n")); | 503 "X-Frame-Options: ALLOWall\r\n")); |
| 504 } | 504 } |
| OLD | NEW |