OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifdef CHROME_PERSONALIZATION | 5 #ifdef CHROME_PERSONALIZATION |
6 | 6 |
7 #include "base/thread.h" | 7 #include "base/thread.h" |
8 #include "chrome/browser/sync/glue/http_bridge.h" | 8 #include "chrome/browser/sync/glue/http_bridge.h" |
9 #include "net/url_request/url_request_unittest.h" | 9 #include "net/url_request/url_request_unittest.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 int os_error = 0; | 152 int os_error = 0; |
153 int response_code = 0; | 153 int response_code = 0; |
154 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); | 154 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); |
155 EXPECT_TRUE(success); | 155 EXPECT_TRUE(success); |
156 EXPECT_EQ(200, response_code); | 156 EXPECT_EQ(200, response_code); |
157 EXPECT_EQ(0, os_error); | 157 EXPECT_EQ(0, os_error); |
158 EXPECT_EQ(0, http_bridge->GetResponseCookieCount()); | 158 EXPECT_EQ(0, http_bridge->GetResponseCookieCount()); |
159 std::string response(http_bridge->GetResponseContent(), | 159 std::string response(http_bridge->GetResponseContent(), |
160 http_bridge->GetResponseContentLength()); | 160 http_bridge->GetResponseContentLength()); |
161 #if BUG_20182_FIXED | |
162 // TODO(chron): Re-enable this expectation. | |
163 EXPECT_EQ(std::string::npos, response.find("Cookie:")); | 161 EXPECT_EQ(std::string::npos, response.find("Cookie:")); |
164 #else | |
165 EXPECT_NE(std::string::npos, response.find("Cookie:")); | |
166 #endif | |
167 EXPECT_NE(std::string::npos, response.find("User-Agent: bob")); | 162 EXPECT_NE(std::string::npos, response.find("User-Agent: bob")); |
168 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); | 163 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); |
169 } | 164 } |
170 | 165 |
171 TEST_F(HttpBridgeTest, TestExtraRequestHeaders) { | 166 TEST_F(HttpBridgeTest, TestExtraRequestHeaders) { |
172 scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, | 167 scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, |
173 NULL); | 168 NULL); |
174 ASSERT_TRUE(NULL != server.get()); | 169 ASSERT_TRUE(NULL != server.get()); |
175 scoped_refptr<HttpBridge> http_bridge(BuildBridge()); | 170 scoped_refptr<HttpBridge> http_bridge(BuildBridge()); |
176 | 171 |
(...skipping 14 matching lines...) Expand all Loading... |
191 EXPECT_EQ(0, os_error); | 186 EXPECT_EQ(0, os_error); |
192 EXPECT_EQ(0, http_bridge->GetResponseCookieCount()); | 187 EXPECT_EQ(0, http_bridge->GetResponseCookieCount()); |
193 std::string response(http_bridge->GetResponseContent(), | 188 std::string response(http_bridge->GetResponseContent(), |
194 http_bridge->GetResponseContentLength()); | 189 http_bridge->GetResponseContentLength()); |
195 | 190 |
196 EXPECT_NE(std::string::npos, response.find("fnord")); | 191 EXPECT_NE(std::string::npos, response.find("fnord")); |
197 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); | 192 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); |
198 } | 193 } |
199 | 194 |
200 #endif // CHROME_PERSONALIZATION | 195 #endif // CHROME_PERSONALIZATION |
OLD | NEW |