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; |