diff options
author | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-21 22:27:30 +0000 |
---|---|---|
committer | chron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-21 22:27:30 +0000 |
commit | 255790a7a6c27dc4c00dd43c578fc39e179a6b1f (patch) | |
tree | 42c476cc68b4eed43c32ac6a3edb5ba2c9588f45 /chrome/browser/sync/glue | |
parent | d21fb774bbd1498cc392d9636338660b58f2ac72 (diff) | |
download | chromium_src-255790a7a6c27dc4c00dd43c578fc39e179a6b1f.zip chromium_src-255790a7a6c27dc4c00dd43c578fc39e179a6b1f.tar.gz chromium_src-255790a7a6c27dc4c00dd43c578fc39e179a6b1f.tar.bz2 |
For bookmark sync, remove cookie support from http bridge and syncapi.
Cookies are problematic for the sync client and no longer necessary.
This code is no longer used.
Review URL: http://codereview.chromium.org/208036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue')
-rw-r--r-- | chrome/browser/sync/glue/http_bridge.cc | 41 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge_unittest.cc | 13 |
3 files changed, 5 insertions, 53 deletions
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()); |