| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bit_cast.h" | 8 #include "base/bit_cast.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 int response_code = 0; | 306 int response_code = 0; |
| 307 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); | 307 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); |
| 308 EXPECT_TRUE(success); | 308 EXPECT_TRUE(success); |
| 309 EXPECT_EQ(200, response_code); | 309 EXPECT_EQ(200, response_code); |
| 310 EXPECT_EQ(0, os_error); | 310 EXPECT_EQ(0, os_error); |
| 311 | 311 |
| 312 std::string response(http_bridge->GetResponseContent(), | 312 std::string response(http_bridge->GetResponseContent(), |
| 313 http_bridge->GetResponseContentLength()); | 313 http_bridge->GetResponseContentLength()); |
| 314 EXPECT_EQ(std::string::npos, response.find("Cookie:")); | 314 EXPECT_EQ(std::string::npos, response.find("Cookie:")); |
| 315 EXPECT_NE(std::string::npos, | 315 EXPECT_NE(std::string::npos, |
| 316 response.find(base::StringPrintf( | |
| 317 "%s: %s", net::HttpRequestHeaders::kAcceptEncoding, | |
| 318 "deflate"))); | |
| 319 EXPECT_NE(std::string::npos, | |
| 320 response.find(base::StringPrintf("%s: %s", | 316 response.find(base::StringPrintf("%s: %s", |
| 321 net::HttpRequestHeaders::kUserAgent, kUserAgent))); | 317 net::HttpRequestHeaders::kUserAgent, kUserAgent))); |
| 322 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); | 318 EXPECT_NE(std::string::npos, response.find(test_payload.c_str())); |
| 323 } | 319 } |
| 324 | 320 |
| 325 TEST_F(MAYBE_SyncHttpBridgeTest, TestExtraRequestHeaders) { | 321 TEST_F(MAYBE_SyncHttpBridgeTest, TestExtraRequestHeaders) { |
| 326 ASSERT_TRUE(test_server_.Start()); | 322 ASSERT_TRUE(test_server_.Start()); |
| 327 | 323 |
| 328 scoped_refptr<HttpBridge> http_bridge(BuildBridge()); | 324 scoped_refptr<HttpBridge> http_bridge(BuildBridge()); |
| 329 | 325 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 582 |
| 587 // Sync thread: Finally run the posted task, only to find that our | 583 // Sync thread: Finally run the posted task, only to find that our |
| 588 // HttpBridgeFactory has been neutered. Should not crash. | 584 // HttpBridgeFactory has been neutered. Should not crash. |
| 589 factory->Init("TestUserAgent", BindToTrackerCallback()); | 585 factory->Init("TestUserAgent", BindToTrackerCallback()); |
| 590 | 586 |
| 591 // At this point, attempting to use the factory would trigger a crash. Both | 587 // At this point, attempting to use the factory would trigger a crash. Both |
| 592 // this test and the real world code should make sure this never happens. | 588 // this test and the real world code should make sure this never happens. |
| 593 } | 589 } |
| 594 | 590 |
| 595 } // namespace syncer | 591 } // namespace syncer |
| OLD | NEW |