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

Unified Diff: chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc

Issue 11341011: Make the BrowsingDataCookieHelper create canonical cookies with the correct cookie-domain attribute. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unittest Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_cookie_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
index d5fc256b567362ee9e744a2beb48854b50d00ebd..69260d12019cd02edae8adb7f319a65c0943a6df 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -110,6 +110,19 @@ class BrowsingDataCookieHelperTest : public testing::Test {
ASSERT_TRUE(++it == cookies.end());
}
+ void CannedDomainCallback(const net::CookieList& cookies) {
+ ASSERT_EQ(1UL, cookies.size());
+ cookie_list_ = cookies;
+ net::CookieList::const_iterator it = cookies.begin();
+
+ ASSERT_TRUE(it != cookies.end());
+ EXPECT_EQ("http://www.google.com/", it->Source());
+ EXPECT_EQ("A", it->Name());
+ EXPECT_EQ("www.google.com", it->Domain());
+
+ ASSERT_TRUE(++it == cookies.end());
+ }
+
void CannedDifferentFramesCallback(const net::CookieList& cookie_list) {
ASSERT_EQ(3U, cookie_list.size());
}
@@ -157,6 +170,32 @@ TEST_F(BrowsingDataCookieHelperTest, DeleteCookie) {
MessageLoop::current()->Run();
}
+TEST_F(BrowsingDataCookieHelperTest, CannedCookieDomain) {
jochen (gone - plz use gerrit) 2012/10/29 16:29:48 can you add a test where you feed the same cookie
markusheintz_ 2012/10/29 18:13:00 Done.
+ const GURL origin("http://www.google.com");
+ net::CookieList cookie;
+
+ scoped_refptr<CannedBrowsingDataCookieHelper> helper(
+ new CannedBrowsingDataCookieHelper(
+ testing_profile_->GetRequestContext()));
+
+ ASSERT_TRUE(helper->empty());
+ helper->AddChangedCookie(origin, origin, "A=1", net::CookieOptions());
+ helper->StartFetching(
+ base::Bind(&BrowsingDataCookieHelperTest::CannedDomainCallback,
+ base::Unretained(this)));
+ cookie = cookie_list_;
+
+ helper->Reset();
+ ASSERT_TRUE(helper->empty());
+
+ helper->AddReadCookies(origin, origin, cookie);
+ helper->StartFetching(
+ base::Bind(&BrowsingDataCookieHelperTest::CannedDomainCallback,
+ base::Unretained(this)));
+}
+
+
+
TEST_F(BrowsingDataCookieHelperTest, CannedUnique) {
const GURL origin("http://www.google.com");
net::CookieList cookie;
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_cookie_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698