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 <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlcom.h> | 6 #include <atlcom.h> |
7 | 7 |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>( | 63 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>( |
64 (*reinterpret_cast<void***>( | 64 (*reinterpret_cast<void***>( |
65 static_cast<IHttpNegotiate*>( | 65 static_cast<IHttpNegotiate*>( |
66 &test_http)))[kBeginningTransactionIndex]); | 66 &test_http)))[kBeginningTransactionIndex]); |
67 | 67 |
68 std::wstring cf_ua( | 68 std::wstring cf_ua( |
69 ASCIIToWide(http_utils::GetDefaultUserAgentHeaderWithCFTag())); | 69 ASCIIToWide(http_utils::GetDefaultUserAgentHeaderWithCFTag())); |
70 std::wstring cf_tag( | 70 std::wstring cf_tag( |
71 ASCIIToWide(http_utils::GetChromeFrameUserAgent())); | 71 ASCIIToWide(http_utils::GetChromeFrameUserAgent())); |
72 | 72 |
73 EXPECT_NE(std::wstring::npos, cf_ua.find(cf_tag)); | 73 EXPECT_NE(std::wstring::npos, cf_ua.find(L"chromeframe/")); |
74 | 74 |
75 struct TestCase { | 75 struct TestCase { |
76 const std::wstring original_headers_; | 76 const std::wstring original_headers_; |
77 const std::wstring delegate_additional_; | 77 const std::wstring delegate_additional_; |
78 const std::wstring expected_additional_; | 78 const std::wstring expected_additional_; |
79 HRESULT delegate_return_value_; | 79 HRESULT delegate_return_value_; |
80 } test_cases[] = { | 80 } test_cases[] = { |
81 { L"Accept: */*\r\n", | 81 { L"Accept: */*\r\n", |
82 L"", | 82 L"", |
83 cf_ua + L"\r\n", | 83 cf_ua + L"\r\n", |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // Check additional headers are preserved. | 210 // Check additional headers are preserved. |
211 EXPECT_THAT(AppendCFUserAgentString(NULL, | 211 EXPECT_THAT(AppendCFUserAgentString(NULL, |
212 L"Authorization: A Zoo That I Ruin\r\n" | 212 L"Authorization: A Zoo That I Ruin\r\n" |
213 L"User-Agent: Get a Nurse;\r\n" | 213 L"User-Agent: Get a Nurse;\r\n" |
214 L"Accept-Language: Cleanup a Cat Egg\r\n"), | 214 L"Accept-Language: Cleanup a Cat Egg\r\n"), |
215 AllOf(ContainsRegex("User-Agent: Get a Nurse; chromeframe.+\r\n"), | 215 AllOf(ContainsRegex("User-Agent: Get a Nurse; chromeframe.+\r\n"), |
216 HasSubstr("Authorization: A Zoo That I Ruin\r\n"), | 216 HasSubstr("Authorization: A Zoo That I Ruin\r\n"), |
217 HasSubstr("Accept-Language: Cleanup a Cat Egg\r\n"))); | 217 HasSubstr("Accept-Language: Cleanup a Cat Egg\r\n"))); |
218 } | 218 } |
OLD | NEW |