summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
diff options
context:
space:
mode:
authormarkusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 20:55:56 +0000
committermarkusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 20:55:56 +0000
commite33839a30e04c0bf4bb61c3d47f27473e095b4c1 (patch)
tree678e068dbaff268b7a56811113a33a58bc3aaf8a /chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
parent91a4ff820789ae3fa1b0795b3bbe574e94a4421f (diff)
downloadchromium_src-e33839a30e04c0bf4bb61c3d47f27473e095b4c1.zip
chromium_src-e33839a30e04c0bf4bb61c3d47f27473e095b4c1.tar.gz
chromium_src-e33839a30e04c0bf4bb61c3d47f27473e095b4c1.tar.bz2
For the cookie counts in the Website Settings UI: Don't count cookies that are sent to multiple hosts during redirects multiple times.
E.g. Let "example.com" be redirected to "www.example.com" and then to"start.example.com". A cookie set with the cookie string "A=B; Domain=.example.com" would be sent to all tree hosts. If we keep separate buckets for each host in the redirect chain than we would collect the same cookie in multiple buckets and count it multiple times. Therefor use only a single list for collecting send cookies. BUG=158353 Review URL: https://codereview.chromium.org/11340015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc')
-rw-r--r--chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc20
1 files changed, 20 insertions, 0 deletions
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 2b6d63a..0aaab16 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -319,4 +319,24 @@ TEST_F(BrowsingDataCookieHelperTest, CannedDifferentFrames) {
base::Unretained(this)));
}
+TEST_F(BrowsingDataCookieHelperTest, CannedGetCookieCount) {
+ GURL frame1_url("http://www.google.com");
+ GURL frame2_url("http://www.google.de");
+ GURL request_url("http://res.google.com");
+ scoped_refptr<CannedBrowsingDataCookieHelper> helper(
+ new CannedBrowsingDataCookieHelper(
+ testing_profile_->GetRequestContext()));
+
+ EXPECT_EQ(0U, helper->GetCookieCount());
+ helper->AddChangedCookie(frame1_url, request_url, "a=1",
+ net::CookieOptions());
+ EXPECT_EQ(1U, helper->GetCookieCount());
+ helper->AddChangedCookie(frame1_url, request_url, "b=1",
+ net::CookieOptions());
+ EXPECT_EQ(2U, helper->GetCookieCount());
+ helper->AddChangedCookie(frame2_url, request_url, "a=2",
+ net::CookieOptions());
+ EXPECT_EQ(2U, helper->GetCookieCount());
+}
+
} // namespace