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

Side by Side Diff: ios/net/cookies/cookie_store_ios_unittest.mm

Issue 2633663003: Implements strict secure cookies as the default behavior in //net (Closed)
Patch Set: Rebase on ToT Created 3 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 | « ios/net/cookies/cookie_store_ios.mm ('k') | net/base/layered_network_delegate.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ios/net/cookies/cookie_store_ios.h" 5 #include "ios/net/cookies/cookie_store_ios.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 28 matching lines...) Expand all
39 store->synchronization_state_ = CookieStoreIOS::SYNCHRONIZED; 39 store->synchronization_state_ = CookieStoreIOS::SYNCHRONIZED;
40 return std::move(store); 40 return std::move(store);
41 } 41 }
42 42
43 static const bool supports_http_only = false; 43 static const bool supports_http_only = false;
44 static const bool supports_non_dotted_domains = false; 44 static const bool supports_non_dotted_domains = false;
45 static const bool preserves_trailing_dots = false; 45 static const bool preserves_trailing_dots = false;
46 static const bool filters_schemes = false; 46 static const bool filters_schemes = false;
47 static const bool has_path_prefix_bug = true; 47 static const bool has_path_prefix_bug = true;
48 static const int creation_time_granularity_in_ms = 1000; 48 static const int creation_time_granularity_in_ms = 1000;
49 static const bool enforce_strict_secure = false;
50 49
51 base::MessageLoop loop_; 50 base::MessageLoop loop_;
52 }; 51 };
53 52
54 struct InactiveCookieStoreIOSTestTraits { 53 struct InactiveCookieStoreIOSTestTraits {
55 static std::unique_ptr<net::CookieStore> Create() { 54 static std::unique_ptr<net::CookieStore> Create() {
56 return base::MakeUnique<CookieStoreIOS>(nullptr); 55 return base::MakeUnique<CookieStoreIOS>(nullptr);
57 } 56 }
58 57
59 static const bool is_cookie_monster = false; 58 static const bool is_cookie_monster = false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Some canonical cookies cannot be converted into System cookies, for 105 // Some canonical cookies cannot be converted into System cookies, for
107 // example if value is not valid utf8. Such cookies are ignored. 106 // example if value is not valid utf8. Such cookies are ignored.
108 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie( 107 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie(
109 net::CanonicalCookie::Create(GURL("http://domain/"), "name", 108 net::CanonicalCookie::Create(GURL("http://domain/"), "name",
110 "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", 109 "\x81r\xe4\xbd\xa0\xe5\xa5\xbd",
111 std::string(), "/path/", 110 std::string(), "/path/",
112 base::Time(), // creation 111 base::Time(), // creation
113 base::Time(), // expires 112 base::Time(), // expires
114 false, // secure 113 false, // secure
115 false, // httponly 114 false, // httponly
116 net::CookieSameSite::DEFAULT_MODE, false, 115 net::CookieSameSite::DEFAULT_MODE,
117 net::COOKIE_PRIORITY_DEFAULT)); 116 net::COOKIE_PRIORITY_DEFAULT));
118 cookies.push_back(std::move(bad_canonical_cookie)); 117 cookies.push_back(std::move(bad_canonical_cookie));
119 loaded_callback_.Run(std::move(cookies)); 118 loaded_callback_.Run(std::move(cookies));
120 } 119 }
121 120
122 bool flushed() { return flushed_; } 121 bool flushed() { return flushed_; }
123 122
124 private: 123 private:
125 // net::CookieMonster::PersistentCookieStore implementation: 124 // net::CookieMonster::PersistentCookieStore implementation:
126 void Load(const LoadedCallback& loaded_callback) override { 125 void Load(const LoadedCallback& loaded_callback) override {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 SetSystemCookie(kTestCookieURL, "abc", "ghi"); 632 SetSystemCookie(kTestCookieURL, "abc", "ghi");
634 EXPECT_EQ(2U, cookies.size()); 633 EXPECT_EQ(2U, cookies.size());
635 // this deletes the callback 634 // this deletes the callback
636 handle.reset(); 635 handle.reset();
637 SetSystemCookie(kTestCookieURL, "abc", "jkl"); 636 SetSystemCookie(kTestCookieURL, "abc", "jkl");
638 EXPECT_EQ(2U, cookies.size()); 637 EXPECT_EQ(2U, cookies.size());
639 DeleteSystemCookie(kTestCookieURL, "abc"); 638 DeleteSystemCookie(kTestCookieURL, "abc");
640 } 639 }
641 640
642 } // namespace net 641 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_store_ios.mm ('k') | net/base/layered_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698