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

Unified Diff: chrome/browser/browsing_data_cookie_helper_unittest.cc

Issue 10092013: Display third party cookies and site data counts in the WebsiteSettings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 8 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
Index: chrome/browser/browsing_data_cookie_helper_unittest.cc
diff --git a/chrome/browser/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data_cookie_helper_unittest.cc
index ef652cb0afc96c4e5c0c7618158510a440a2bc48..144c4d8b90e8cd71be29243f094c8503c184216d 100644
--- a/chrome/browser/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data_cookie_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -111,6 +111,11 @@ class BrowsingDataCookieHelperTest : public testing::Test {
ASSERT_TRUE(++it == cookies.end());
}
+ void CannedDifferentFramesCallback(const net::CookieList& cookie_list) {
+ ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
bauerb at google 2012/04/27 16:12:50 This line does not test what you think it tests ;-
markusheintz_ 2012/05/10 16:32:36 :( . Stupid me. I removed the line. I also removed
+ ASSERT_EQ(3U, cookie_list.size());
+ }
+
protected:
MessageLoop message_loop_;
scoped_ptr<content::TestBrowserThread> ui_thread_;
@@ -162,8 +167,8 @@ TEST_F(BrowsingDataCookieHelperTest, CannedUnique) {
new CannedBrowsingDataCookieHelper(testing_profile_.get()));
ASSERT_TRUE(helper->empty());
- helper->AddChangedCookie(origin, "A=1", net::CookieOptions());
- helper->AddChangedCookie(origin, "A=1", net::CookieOptions());
+ helper->AddChangedCookie(origin, origin, "A=1", net::CookieOptions());
+ helper->AddChangedCookie(origin, origin, "A=1", net::CookieOptions());
helper->StartFetching(
base::Bind(&BrowsingDataCookieHelperTest::CannedUniqueCallback,
base::Unretained(this)));
@@ -171,8 +176,8 @@ TEST_F(BrowsingDataCookieHelperTest, CannedUnique) {
helper->Reset();
ASSERT_TRUE(helper->empty());
- helper->AddReadCookies(origin, cookie);
- helper->AddReadCookies(origin, cookie);
+ helper->AddReadCookies(origin, origin, cookie);
+ helper->AddReadCookies(origin, origin, cookie);
helper->StartFetching(
base::Bind(&BrowsingDataCookieHelperTest::CannedUniqueCallback,
base::Unretained(this)));
@@ -185,7 +190,7 @@ TEST_F(BrowsingDataCookieHelperTest, CannedEmpty) {
new CannedBrowsingDataCookieHelper(testing_profile_.get()));
ASSERT_TRUE(helper->empty());
- helper->AddChangedCookie(url_google, "a=1",
+ helper->AddChangedCookie(url_google, url_google, "a=1",
net::CookieOptions());
ASSERT_FALSE(helper->empty());
helper->Reset();
@@ -197,10 +202,31 @@ TEST_F(BrowsingDataCookieHelperTest, CannedEmpty) {
new net::CookieMonster::CanonicalCookie(url_google, pc));
cookies.push_back(*cookie);
- helper->AddReadCookies(url_google, cookies);
+ helper->AddReadCookies(url_google, url_google, cookies);
ASSERT_FALSE(helper->empty());
helper->Reset();
ASSERT_TRUE(helper->empty());
}
+TEST_F(BrowsingDataCookieHelperTest, CannedDifferentFrames) {
+ GURL frame1_url("http://www.google.com");
+ GURL frame2_url("http://www.google.de");
+ GURL request_url("http://www.google.com");
+
+ scoped_refptr<CannedBrowsingDataCookieHelper> helper(
+ new CannedBrowsingDataCookieHelper(testing_profile_.get()));
+
+ ASSERT_TRUE(helper->empty());
+ helper->AddChangedCookie(frame1_url, request_url, "a=1",
+ net::CookieOptions());
+ helper->AddChangedCookie(frame1_url, request_url, "b=1",
+ net::CookieOptions());
+ helper->AddChangedCookie(frame2_url, request_url, "c=1",
+ net::CookieOptions());
+
+ helper->StartFetching(
+ base::Bind(&BrowsingDataCookieHelperTest::CannedDifferentFramesCallback,
+ base::Unretained(this)));
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698