summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/sync/engine/syncapi.h12
-rw-r--r--chrome/browser/sync/glue/http_bridge.cc41
-rw-r--r--chrome/browser/sync/glue/http_bridge.h4
-rw-r--r--chrome/browser/sync/glue/http_bridge_unittest.cc13
4 files changed, 5 insertions, 65 deletions
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index 36a6efb..d8e2601b 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -632,11 +632,6 @@ class HttpPostProviderInterface {
virtual void SetPostPayload(const char* content_type, int content_length,
const char* content) = 0;
- // Add the specified cookie to the request context using the url set by
- // SetURL as the key. |cookie| should be a standard cookie line
- // [e.g "name=val; name2=val2"]. |cookie| should be copied.
- virtual void AddCookieForRequest(const char* cookie) = 0;
-
// Returns true if the URL request succeeded. If the request failed,
// os_error() may be non-zero and hence contain more information.
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) = 0;
@@ -651,13 +646,6 @@ class HttpPostProviderInterface {
// Value should be copied.
virtual const char* GetResponseContent() const = 0;
- // To simplify passing a vector<string> across this API, we provide the
- // following two methods. Use GetResponseCookieCount to bound a loop calling
- // GetResponseCookieAt once for each integer in the range
- // [0, GetNumCookiesInResponse). The char* returned should be copied.
- virtual int GetResponseCookieCount() const = 0;
- virtual const char* GetResponseCookieAt(int cookie_number) const = 0;
-
private:
DISALLOW_COPY_AND_ASSIGN(HttpPostProviderInterface);
};
diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc
index 54e93ed..304f91e 100644
--- a/chrome/browser/sync/glue/http_bridge.cc
+++ b/chrome/browser/sync/glue/http_bridge.cc
@@ -143,19 +143,6 @@ void HttpBridge::SetPostPayload(const char* content_type,
}
}
-void HttpBridge::AddCookieForRequest(const char* cookie) {
- DCHECK_EQ(MessageLoop::current(), created_on_loop_);
- DCHECK(!request_completed_);
- DCHECK(url_for_request_.is_valid()) << "Valid URL not set.";
- if (!url_for_request_.is_valid()) return;
-
- if (!context_for_request_->cookie_store()->SetCookie(url_for_request_,
- cookie)) {
- DLOG(WARNING) << "Cookie " << cookie
- << " could not be added for url: " << url_for_request_ << ".";
- }
-}
-
bool HttpBridge::MakeSynchronousPost(int* os_error_code, int* response_code) {
DCHECK_EQ(MessageLoop::current(), created_on_loop_);
DCHECK(!request_completed_);
@@ -202,23 +189,6 @@ const char* HttpBridge::GetResponseContent() const {
return response_content_.data();
}
-int HttpBridge::GetResponseCookieCount() const {
- DCHECK_EQ(MessageLoop::current(), created_on_loop_);
- DCHECK(request_completed_);
- return response_cookies_.size();
-}
-
-const char* HttpBridge::GetResponseCookieAt(int cookie_number) const {
- DCHECK_EQ(MessageLoop::current(), created_on_loop_);
- DCHECK(request_completed_);
- bool valid_number = (cookie_number >= 0) &&
- (static_cast<size_t>(cookie_number) < response_cookies_.size());
- DCHECK(valid_number);
- if (!valid_number)
- return NULL;
- return response_cookies_[cookie_number].c_str();
-}
-
void HttpBridge::OnURLFetchComplete(const URLFetcher *source, const GURL &url,
const URLRequestStatus &status,
int response_code,
@@ -231,17 +201,6 @@ void HttpBridge::OnURLFetchComplete(const URLFetcher *source, const GURL &url,
http_response_code_ = response_code;
os_error_code_ = status.os_error();
- // TODO(timsteele): For now we need this "fixup" to match up with what the
- // sync backend expects. This seems to be non-standard and shouldn't be done
- // here in HttpBridge, and it breaks part of the unittest.
- for (size_t i = 0; i < cookies.size(); ++i) {
- net::CookieMonster::ParsedCookie parsed_cookie(cookies[i]);
- std::string cookie = " \t \t \t \t \t";
- cookie += parsed_cookie.Name() + "\t";
- cookie += parsed_cookie.Value();
- response_cookies_.push_back(cookie);
- }
-
response_content_ = data;
// End of the line for url_poster_. It lives only on the io_loop.
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index 90ffff6..b3dfc4f 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -81,7 +81,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
virtual void SetURL(const char* url, int port);
virtual void SetPostPayload(const char* content_type, int content_length,
const char* content);
- virtual void AddCookieForRequest(const char* cookie);
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code);
// WARNING: these response content methods are used to extract plain old data
@@ -90,8 +89,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
// string r(b->GetResponseContent(), b->GetResponseContentLength()).
virtual int GetResponseContentLength() const;
virtual const char* GetResponseContent() const;
- virtual int GetResponseCookieCount() const;
- virtual const char* GetResponseCookieAt(int cookie_number) const;
// URLFetcher::Delegate implementation.
virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url,
@@ -147,7 +144,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
bool request_succeeded_;
int http_response_code_;
int os_error_code_;
- ResponseCookies response_cookies_;
std::string response_content_;
// A waitable event we use to provide blocking semantics to
diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc
index a61cba0..1e785dc 100644
--- a/chrome/browser/sync/glue/http_bridge_unittest.cc
+++ b/chrome/browser/sync/glue/http_bridge_unittest.cc
@@ -100,7 +100,6 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostShunted) {
EXPECT_TRUE(success);
EXPECT_EQ(200, response_code);
EXPECT_EQ(0, os_error);
- EXPECT_EQ(0, http_bridge->GetResponseCookieCount());
EXPECT_EQ(8, http_bridge->GetResponseContentLength());
EXPECT_EQ(std::string("success!"),
@@ -127,13 +126,12 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveWithPayload) {
EXPECT_TRUE(success);
EXPECT_EQ(200, response_code);
EXPECT_EQ(0, os_error);
- EXPECT_EQ(0, http_bridge->GetResponseCookieCount());
+
EXPECT_EQ(payload.length() + 1, http_bridge->GetResponseContentLength());
EXPECT_EQ(payload, std::string(http_bridge->GetResponseContent()));
}
-// Full round-trip test of the HttpBridge, using custom UA string and
-// multiple request cookies. Cookies should not come back.
+// Full round-trip test of the HttpBridge, using custom UA string
TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) {
scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot,
NULL);
@@ -143,8 +141,7 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) {
GURL echo_header = server->TestServerPage("echoall");
http_bridge->SetUserAgent("bob");
http_bridge->SetURL(echo_header.spec().c_str(), echo_header.IntPort());
- http_bridge->AddCookieForRequest("foo=bar");
- http_bridge->AddCookieForRequest("baz=boo");
+
std::string test_payload = "###TEST PAYLOAD###";
http_bridge->SetPostPayload("text/html", test_payload.length() + 1,
test_payload.c_str());
@@ -155,7 +152,7 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) {
EXPECT_TRUE(success);
EXPECT_EQ(200, response_code);
EXPECT_EQ(0, os_error);
- EXPECT_EQ(0, http_bridge->GetResponseCookieCount());
+
std::string response(http_bridge->GetResponseContent(),
http_bridge->GetResponseContentLength());
EXPECT_EQ(std::string::npos, response.find("Cookie:"));
@@ -184,7 +181,7 @@ TEST_F(HttpBridgeTest, TestExtraRequestHeaders) {
EXPECT_TRUE(success);
EXPECT_EQ(200, response_code);
EXPECT_EQ(0, os_error);
- EXPECT_EQ(0, http_bridge->GetResponseCookieCount());
+
std::string response(http_bridge->GetResponseContent(),
http_bridge->GetResponseContentLength());