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

Side by Side Diff: net/cookies/cookie_monster_unittest.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « net/cookies/cookie_monster_perftest.cc ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cookies/cookie_store_unittest.h" 5 #include "net/cookies/cookie_store_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual void Flush(const base::Closure& callback) { 54 virtual void Flush(const base::Closure& callback) {
55 if (!callback.is_null()) 55 if (!callback.is_null())
56 base::MessageLoop::current()->PostTask(FROM_HERE, callback); 56 base::MessageLoop::current()->PostTask(FROM_HERE, callback);
57 } 57 }
58 MOCK_METHOD0(SetForceKeepSessionState, void()); 58 MOCK_METHOD0(SetForceKeepSessionState, void());
59 59
60 private: 60 private:
61 virtual ~NewMockPersistentCookieStore() {} 61 virtual ~NewMockPersistentCookieStore() {}
62 }; 62 };
63 63
64 const char* kTopLevelDomainPlus1 = "http://www.harvard.edu"; 64 const char kTopLevelDomainPlus1[] = "http://www.harvard.edu";
65 const char* kTopLevelDomainPlus2 = "http://www.math.harvard.edu"; 65 const char kTopLevelDomainPlus2[] = "http://www.math.harvard.edu";
66 const char* kTopLevelDomainPlus2Secure = "https://www.math.harvard.edu"; 66 const char kTopLevelDomainPlus2Secure[] = "https://www.math.harvard.edu";
67 const char* kTopLevelDomainPlus3 = 67 const char kTopLevelDomainPlus3[] =
68 "http://www.bourbaki.math.harvard.edu"; 68 "http://www.bourbaki.math.harvard.edu";
69 const char* kOtherDomain = "http://www.mit.edu"; 69 const char kOtherDomain[] = "http://www.mit.edu";
70 const char kUrlGoogleSpecific[] = "http://www.gmail.google.izzle"; 70 const char kUrlGoogleSpecific[] = "http://www.gmail.google.izzle";
71 71
72 class GetCookieListCallback : public CookieCallback { 72 class GetCookieListCallback : public CookieCallback {
73 public: 73 public:
74 GetCookieListCallback() {} 74 GetCookieListCallback() {}
75 explicit GetCookieListCallback(Thread* run_in_thread) 75 explicit GetCookieListCallback(Thread* run_in_thread)
76 : CookieCallback(run_in_thread) {} 76 : CookieCallback(run_in_thread) {}
77 77
78 void Run(const CookieList& cookies) { 78 void Run(const CookieList& cookies) {
79 cookies_ = cookies; 79 cookies_ = cookies;
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1245
1246 EXPECT_FALSE(FindAndDeleteCookie(cm.get(), "random.host", "E")); 1246 EXPECT_FALSE(FindAndDeleteCookie(cm.get(), "random.host", "E"));
1247 EXPECT_EQ("A=B; E=F", GetCookies(cm.get(), url_google_)); 1247 EXPECT_EQ("A=B; E=F", GetCookies(cm.get(), url_google_));
1248 } 1248 }
1249 1249
1250 TEST_F(CookieMonsterTest, SetCookieableSchemes) { 1250 TEST_F(CookieMonsterTest, SetCookieableSchemes) {
1251 scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL)); 1251 scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL));
1252 scoped_refptr<CookieMonster> cm_foo(new CookieMonster(NULL, NULL)); 1252 scoped_refptr<CookieMonster> cm_foo(new CookieMonster(NULL, NULL));
1253 1253
1254 // Only cm_foo should allow foo:// cookies. 1254 // Only cm_foo should allow foo:// cookies.
1255 const char* kSchemes[] = {"foo"}; 1255 const char* const kSchemes[] = {"foo"};
1256 cm_foo->SetCookieableSchemes(kSchemes, 1); 1256 cm_foo->SetCookieableSchemes(kSchemes, 1);
1257 1257
1258 GURL foo_url("foo://host/path"); 1258 GURL foo_url("foo://host/path");
1259 GURL http_url("http://host/path"); 1259 GURL http_url("http://host/path");
1260 1260
1261 EXPECT_TRUE(SetCookie(cm.get(), http_url, "x=1")); 1261 EXPECT_TRUE(SetCookie(cm.get(), http_url, "x=1"));
1262 EXPECT_FALSE(SetCookie(cm.get(), foo_url, "x=1")); 1262 EXPECT_FALSE(SetCookie(cm.get(), foo_url, "x=1"));
1263 EXPECT_TRUE(SetCookie(cm_foo.get(), foo_url, "x=1")); 1263 EXPECT_TRUE(SetCookie(cm_foo.get(), foo_url, "x=1"));
1264 EXPECT_FALSE(SetCookie(cm_foo.get(), http_url, "x=1")); 1264 EXPECT_FALSE(SetCookie(cm_foo.get(), http_url, "x=1"));
1265 } 1265 }
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2879 scoped_ptr<CookieStore::CookieChangedSubscription> sub1( 2879 scoped_ptr<CookieStore::CookieChangedSubscription> sub1(
2880 monster()->AddCallbackForCookie(test_url_, "abc", 2880 monster()->AddCallbackForCookie(test_url_, "abc",
2881 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); 2881 base::Bind(&RecordCookieChanges, &cookies1, nullptr)));
2882 SetCookie(monster(), test_url_, "abc=def"); 2882 SetCookie(monster(), test_url_, "abc=def");
2883 base::MessageLoop::current()->RunUntilIdle(); 2883 base::MessageLoop::current()->RunUntilIdle();
2884 EXPECT_EQ(1U, cookies0.size()); 2884 EXPECT_EQ(1U, cookies0.size());
2885 EXPECT_EQ(1U, cookies0.size()); 2885 EXPECT_EQ(1U, cookies0.size());
2886 } 2886 }
2887 2887
2888 } // namespace net 2888 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_perftest.cc ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698