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

Side by Side Diff: net/base/static_cookie_policy_unittest.cc

Issue 7008025: Apply third party cookie blocking to all kinds of cookies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/net_errors.h" 5 #include "net/base/net_errors.h"
6 #include "net/base/static_cookie_policy.h" 6 #include "net/base/static_cookie_policy.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 class StaticCookiePolicyTest : public testing::Test { 12 class StaticCookiePolicyTest : public testing::Test {
13 public: 13 public:
14 StaticCookiePolicyTest() 14 StaticCookiePolicyTest()
15 : url_google_("http://www.google.izzle"), 15 : url_google_("http://www.google.izzle"),
16 url_google_secure_("https://www.google.izzle"), 16 url_google_secure_("https://www.google.izzle"),
17 url_google_mail_("http://mail.google.izzle"), 17 url_google_mail_("http://mail.google.izzle"),
18 url_google_analytics_("http://www.googleanalytics.izzle") { 18 url_google_analytics_("http://www.googleanalytics.izzle") {
19 } 19 }
20 void SetPolicyType(StaticCookiePolicy::Type type) { 20 void SetPolicyType(StaticCookiePolicy::Type type) {
21 policy_.set_type(type); 21 policy_.set_type(type);
22 } 22 }
23 int CanGetCookies(const GURL& url, const GURL& first_party) { 23 int CanGetCookies(const GURL& url, const GURL& first_party) {
24 return policy_.CanGetCookies(url, first_party); 24 return policy_.CanGetCookies(url, first_party);
25 } 25 }
26 int CanSetCookie(const GURL& url, const GURL& first_party) { 26 int CanSetCookie(const GURL& url, const GURL& first_party) {
27 return policy_.CanSetCookie(url, first_party, std::string()); 27 return policy_.CanSetCookie(url, first_party);
28 } 28 }
29 protected: 29 protected:
30 StaticCookiePolicy policy_; 30 StaticCookiePolicy policy_;
31 GURL url_google_; 31 GURL url_google_;
32 GURL url_google_secure_; 32 GURL url_google_secure_;
33 GURL url_google_mail_; 33 GURL url_google_mail_;
34 GURL url_google_analytics_; 34 GURL url_google_analytics_;
35 }; 35 };
36 36
37 TEST_F(StaticCookiePolicyTest, DefaultPolicyTest) { 37 TEST_F(StaticCookiePolicyTest, DefaultPolicyTest) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_NE(OK, CanGetCookies(url_google_, GURL())); 106 EXPECT_NE(OK, CanGetCookies(url_google_, GURL()));
107 107
108 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_)); 108 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_));
109 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_secure_)); 109 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_secure_));
110 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_mail_)); 110 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_mail_));
111 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_analytics_)); 111 EXPECT_NE(OK, CanSetCookie(url_google_, url_google_analytics_));
112 EXPECT_NE(OK, CanSetCookie(url_google_, GURL())); 112 EXPECT_NE(OK, CanSetCookie(url_google_, GURL()));
113 } 113 }
114 114
115 } // namespace net 115 } // namespace net
OLDNEW
« no previous file with comments | « net/base/static_cookie_policy.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698