Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: chrome_frame/test/http_negotiate_unittest.cc

Issue 112433004: Update uses of UTF conversions in chrome_frame/, chromeos/, components/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/header_test.cc ('k') | chrome_frame/test/ie_event_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <atlbase.h> 5 #include <atlbase.h>
6 #include <atlcom.h> 6 #include <atlcom.h>
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 TEST_F(HttpNegotiateTest, BeginningTransaction) { 61 TEST_F(HttpNegotiateTest, BeginningTransaction) {
62 static const int kBeginningTransactionIndex = 3; 62 static const int kBeginningTransactionIndex = 3;
63 CComObjectStackEx<TestHttpNegotiate> test_http; 63 CComObjectStackEx<TestHttpNegotiate> test_http;
64 IHttpNegotiate_BeginningTransaction_Fn original = 64 IHttpNegotiate_BeginningTransaction_Fn original =
65 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>( 65 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>(
66 (*reinterpret_cast<void***>( 66 (*reinterpret_cast<void***>(
67 static_cast<IHttpNegotiate*>( 67 static_cast<IHttpNegotiate*>(
68 &test_http)))[kBeginningTransactionIndex]); 68 &test_http)))[kBeginningTransactionIndex]);
69 69
70 base::string16 cf_ua( 70 base::string16 cf_ua(
71 ASCIIToWide(http_utils::GetDefaultUserAgentHeaderWithCFTag())); 71 base::ASCIIToWide(http_utils::GetDefaultUserAgentHeaderWithCFTag()));
72 base::string16 cf_tag(ASCIIToWide(http_utils::GetChromeFrameUserAgent())); 72 base::string16 cf_tag(
73 base::ASCIIToWide(http_utils::GetChromeFrameUserAgent()));
73 74
74 EXPECT_NE(base::string16::npos, cf_ua.find(L"chromeframe/")); 75 EXPECT_NE(base::string16::npos, cf_ua.find(L"chromeframe/"));
75 76
76 struct TestCase { 77 struct TestCase {
77 const base::string16 original_headers_; 78 const base::string16 original_headers_;
78 const base::string16 delegate_additional_; 79 const base::string16 delegate_additional_;
79 const base::string16 expected_additional_; 80 const base::string16 expected_additional_;
80 HRESULT delegate_return_value_; 81 HRESULT delegate_return_value_;
81 } test_cases[] = { 82 } test_cases[] = {
82 { L"Accept: */*\r\n", 83 { L"Accept: */*\r\n",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 TEST_F(HttpNegotiateTest, BeginningTransactionUARemoval) { 127 TEST_F(HttpNegotiateTest, BeginningTransactionUARemoval) {
127 static const int kBeginningTransactionIndex = 3; 128 static const int kBeginningTransactionIndex = 3;
128 CComObjectStackEx<TestHttpNegotiate> test_http; 129 CComObjectStackEx<TestHttpNegotiate> test_http;
129 IHttpNegotiate_BeginningTransaction_Fn original = 130 IHttpNegotiate_BeginningTransaction_Fn original =
130 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>( 131 reinterpret_cast<IHttpNegotiate_BeginningTransaction_Fn>(
131 (*reinterpret_cast<void***>( 132 (*reinterpret_cast<void***>(
132 static_cast<IHttpNegotiate*>( 133 static_cast<IHttpNegotiate*>(
133 &test_http)))[kBeginningTransactionIndex]); 134 &test_http)))[kBeginningTransactionIndex]);
134 135
135 base::string16 nocf_ua( 136 base::string16 nocf_ua(
136 ASCIIToWide(http_utils::RemoveChromeFrameFromUserAgentValue( 137 base::ASCIIToWide(http_utils::RemoveChromeFrameFromUserAgentValue(
137 http_utils::GetDefaultUserAgentHeaderWithCFTag()))); 138 http_utils::GetDefaultUserAgentHeaderWithCFTag())));
138 base::string16 cf_ua(ASCIIToWide( 139 base::string16 cf_ua(base::ASCIIToWide(
139 http_utils::AddChromeFrameToUserAgentValue(WideToASCII(nocf_ua)))); 140 http_utils::AddChromeFrameToUserAgentValue(WideToASCII(nocf_ua))));
140 141
141 EXPECT_EQ(base::string16::npos, nocf_ua.find(L"chromeframe/")); 142 EXPECT_EQ(base::string16::npos, nocf_ua.find(L"chromeframe/"));
142 EXPECT_NE(base::string16::npos, cf_ua.find(L"chromeframe/")); 143 EXPECT_NE(base::string16::npos, cf_ua.find(L"chromeframe/"));
143 144
144 base::string16 ua_url(L"www.withua.com"); 145 base::string16 ua_url(L"www.withua.com");
145 base::string16 no_ua_url(L"www.noua.com"); 146 base::string16 no_ua_url(L"www.noua.com");
146 147
147 RegistryListPreferencesHolder& ua_holder = 148 RegistryListPreferencesHolder& ua_holder =
148 GetUserAgentPreferencesHolderForTesting(); 149 GetUserAgentPreferencesHolderForTesting();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 280
280 // Check additional headers are preserved. 281 // Check additional headers are preserved.
281 EXPECT_THAT(AppendCFUserAgentString(NULL, 282 EXPECT_THAT(AppendCFUserAgentString(NULL,
282 L"Authorization: A Zoo That I Ruin\r\n" 283 L"Authorization: A Zoo That I Ruin\r\n"
283 L"User-Agent: Get a Nurse;\r\n" 284 L"User-Agent: Get a Nurse;\r\n"
284 L"Accept-Language: Cleanup a Cat Egg\r\n"), 285 L"Accept-Language: Cleanup a Cat Egg\r\n"),
285 AllOf(ContainsRegex("User-Agent: Get a Nurse; chromeframe.+\r\n"), 286 AllOf(ContainsRegex("User-Agent: Get a Nurse; chromeframe.+\r\n"),
286 HasSubstr("Authorization: A Zoo That I Ruin\r\n"), 287 HasSubstr("Authorization: A Zoo That I Ruin\r\n"),
287 HasSubstr("Accept-Language: Cleanup a Cat Egg\r\n"))); 288 HasSubstr("Accept-Language: Cleanup a Cat Egg\r\n")));
288 } 289 }
OLDNEW
« no previous file with comments | « chrome_frame/test/header_test.cc ('k') | chrome_frame/test/ie_event_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698