diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 22:54:29 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 22:54:29 +0000 |
commit | 8396a3e147d9639f71e674d814b9e72b654bad28 (patch) | |
tree | ebdacf6ca262294b68ccdf353145d2cdaf0df488 | |
parent | 7f4f86a43e2da780bedf24f2c6ba5210cfab86e7 (diff) | |
download | chromium_src-8396a3e147d9639f71e674d814b9e72b654bad28.zip chromium_src-8396a3e147d9639f71e674d814b9e72b654bad28.tar.gz chromium_src-8396a3e147d9639f71e674d814b9e72b654bad28.tar.bz2 |
r37624 abandoned code that isn't in the project any more. Deleting the unused files.
See http://codereview.chromium.org/556095 .
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/552265
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37759 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/cookie_policy.cc | 49 | ||||
-rw-r--r-- | net/base/cookie_policy_unittest.cc | 87 |
2 files changed, 0 insertions, 136 deletions
diff --git a/net/base/cookie_policy.cc b/net/base/cookie_policy.cc deleted file mode 100644 index 0092d8a..0000000 --- a/net/base/cookie_policy.cc +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#include "net/base/cookie_policy.h" - -#include "base/logging.h" -#include "googleurl/src/gurl.h" -#include "net/base/registry_controlled_domain.h" - -namespace net { - -bool CookiePolicy::CanGetCookies(const GURL& url, - const GURL& first_party_for_cookies) { - switch (type_) { - case CookiePolicy::ALLOW_ALL_COOKIES: - return true; - case CookiePolicy::BLOCK_THIRD_PARTY_COOKIES: - return true; - case CookiePolicy::BLOCK_ALL_COOKIES: - return false; - default: - NOTREACHED(); - return false; - } -} - -bool CookiePolicy::CanSetCookie(const GURL& url, - const GURL& first_party_for_cookies) { - switch (type_) { - case CookiePolicy::ALLOW_ALL_COOKIES: - return true; - case CookiePolicy::BLOCK_THIRD_PARTY_COOKIES: - if (first_party_for_cookies.is_empty()) - return true; // Empty first-party URL indicates a first-party request. - return net::RegistryControlledDomainService::SameDomainOrHost( - url, first_party_for_cookies); - case CookiePolicy::BLOCK_ALL_COOKIES: - return false; - default: - NOTREACHED(); - return false; - } -} - -CookiePolicy::CookiePolicy() : type_(CookiePolicy::ALLOW_ALL_COOKIES) { -} - -} // namespace net diff --git a/net/base/cookie_policy_unittest.cc b/net/base/cookie_policy_unittest.cc deleted file mode 100644 index 22cf59e..0000000 --- a/net/base/cookie_policy_unittest.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#include "net/base/cookie_policy.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "googleurl/src/gurl.h" - -class CookiePolicyTest : public testing::Test { - public: - CookiePolicyTest() - : url_google_("http://www.google.izzle"), - url_google_secure_("https://www.google.izzle"), - url_google_mail_("http://mail.google.izzle"), - url_google_analytics_("http://www.googleanalytics.izzle") { } - protected: - GURL url_google_; - GURL url_google_secure_; - GURL url_google_mail_; - GURL url_google_analytics_; -}; - -TEST_F(CookiePolicyTest, DefaultPolicyTest) { - net::CookiePolicy cp; - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_mail_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, GURL())); - - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_mail_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, GURL())); -} - -TEST_F(CookiePolicyTest, AllowAllCookiesTest) { - net::CookiePolicy cp; - cp.set_type(net::CookiePolicy::ALLOW_ALL_COOKIES); - - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_mail_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, GURL())); - - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_mail_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, GURL())); -} - -TEST_F(CookiePolicyTest, BlockThirdPartyCookiesTest) { - net::CookiePolicy cp; - cp.set_type(net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES); - - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_mail_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanGetCookies(url_google_, GURL())); - - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_secure_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, url_google_mail_)); - EXPECT_FALSE(cp.CanSetCookie(url_google_, url_google_analytics_)); - EXPECT_TRUE(cp.CanSetCookie(url_google_, GURL())); -} - -TEST_F(CookiePolicyTest, BlockAllCookiesTest) { - net::CookiePolicy cp; - cp.set_type(net::CookiePolicy::BLOCK_ALL_COOKIES); - - EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_)); - EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_secure_)); - EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_mail_)); - EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_analytics_)); - EXPECT_FALSE(cp.CanGetCookies(url_google_, GURL())); - - EXPECT_FALSE(cp.CanSetCookie(url_google_, url_google_)); - EXPECT_FALSE(cp.CanSetCookie(url_google_, url_google_secure_)); - EXPECT_FALSE(cp.CanSetCookie(url_google_, url_google_mail_)); - EXPECT_FALSE(cp.CanSetCookie(url_google_, url_google_analytics_)); - EXPECT_FALSE(cp.CanSetCookie(url_google_, GURL())); -} |