OLD | NEW |
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 "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
12 #import "net/base/mac/url_conversions.h" | 14 #import "net/base/mac/url_conversions.h" |
13 #include "net/cookies/cookie_store_unittest.h" | 15 #include "net/cookies/cookie_store_unittest.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
15 | 17 |
16 namespace { | 18 namespace { |
17 // Clears the underlying NSHTTPCookieStorage. | 19 // Clears the underlying NSHTTPCookieStorage. |
18 void ClearCookies() { | 20 void ClearCookies() { |
19 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 21 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
20 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | 22 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
21 NSArray* cookies = [store cookies]; | 23 NSArray* cookies = [store cookies]; |
22 for (NSHTTPCookie* cookie in cookies) | 24 for (NSHTTPCookie* cookie in cookies) |
23 [store deleteCookie:cookie]; | 25 [store deleteCookie:cookie]; |
24 EXPECT_EQ(0u, [[store cookies] count]); | 26 EXPECT_EQ(0u, [[store cookies] count]); |
25 } | 27 } |
26 } // namespace | 28 } // namespace |
27 | 29 |
28 namespace net { | 30 namespace net { |
29 | 31 |
30 struct CookieStoreIOSTestTraits { | 32 struct CookieStoreIOSTestTraits { |
31 static net::CookieStore* Create() { | 33 static scoped_ptr<net::CookieStore> Create() { |
32 ClearCookies(); | 34 ClearCookies(); |
33 CookieStoreIOS* store = new CookieStoreIOS(nullptr); | 35 scoped_ptr<CookieStoreIOS> store(new CookieStoreIOS(nullptr)); |
34 store->synchronization_state_ = CookieStoreIOS::SYNCHRONIZED; | 36 store->synchronization_state_ = CookieStoreIOS::SYNCHRONIZED; |
35 return store; | 37 return std::move(store); |
36 } | 38 } |
37 | 39 |
38 static const bool supports_http_only = false; | 40 static const bool supports_http_only = false; |
39 static const bool supports_non_dotted_domains = false; | 41 static const bool supports_non_dotted_domains = false; |
40 static const bool preserves_trailing_dots = false; | 42 static const bool preserves_trailing_dots = false; |
41 static const bool filters_schemes = false; | 43 static const bool filters_schemes = false; |
42 static const bool has_path_prefix_bug = true; | 44 static const bool has_path_prefix_bug = true; |
43 static const int creation_time_granularity_in_ms = 1000; | 45 static const int creation_time_granularity_in_ms = 1000; |
44 static const bool enforce_strict_secure = false; | 46 static const bool enforce_strict_secure = false; |
45 | 47 |
46 base::MessageLoop loop_; | 48 base::MessageLoop loop_; |
47 }; | 49 }; |
48 | 50 |
49 struct InactiveCookieStoreIOSTestTraits { | 51 struct InactiveCookieStoreIOSTestTraits { |
50 static scoped_refptr<net::CookieStore> Create() { | 52 static scoped_ptr<net::CookieStore> Create() { |
51 return new CookieStoreIOS(nullptr); | 53 return make_scoped_ptr(new CookieStoreIOS(nullptr)); |
52 } | 54 } |
53 | 55 |
54 static const bool is_cookie_monster = false; | 56 static const bool is_cookie_monster = false; |
55 static const bool supports_http_only = false; | 57 static const bool supports_http_only = false; |
56 static const bool supports_non_dotted_domains = true; | 58 static const bool supports_non_dotted_domains = true; |
57 static const bool preserves_trailing_dots = true; | 59 static const bool preserves_trailing_dots = true; |
58 static const bool filters_schemes = false; | 60 static const bool filters_schemes = false; |
59 static const bool has_path_prefix_bug = false; | 61 static const bool has_path_prefix_bug = false; |
60 static const int creation_time_granularity_in_ms = 0; | 62 static const int creation_time_granularity_in_ms = 0; |
61 static const int enforces_prefixes = true; | 63 static const int enforces_prefixes = true; |
62 static const bool enforce_strict_secure = false; | 64 static const bool enforce_strict_secure = false; |
63 | 65 |
64 base::MessageLoop loop_; | 66 base::MessageLoop loop_; |
65 }; | 67 }; |
66 | 68 |
67 // RoundTripTestCookieStore is un-synchronized and re-synchronized after all | 69 // RoundTripTestCookieStore is un-synchronized and re-synchronized after all |
68 // cookie operations. This means all system cookies are converted to Chrome | 70 // cookie operations. This means all system cookies are converted to Chrome |
69 // cookies and converted back. | 71 // cookies and converted back. |
70 // The purpose of this class is to test that cookie conversions do not break the | 72 // The purpose of this class is to test that cookie conversions do not break the |
71 // cookie store. | 73 // cookie store. |
72 class RoundTripTestCookieStore : public net::CookieStore { | 74 class RoundTripTestCookieStore : public net::CookieStore { |
73 public: | 75 public: |
74 RoundTripTestCookieStore() | 76 RoundTripTestCookieStore() |
75 : store_(new CookieStoreIOS(nullptr)), | 77 : store_(new CookieStoreIOS(nullptr)), |
76 dummy_store_(new CookieStoreIOS(nullptr)) { | 78 dummy_store_(new CookieStoreIOS(nullptr)) { |
77 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 79 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
78 } | 80 } |
79 | 81 |
| 82 ~RoundTripTestCookieStore() override { store_->UnSynchronize(); } |
| 83 |
80 // Inherited CookieStore methods. | 84 // Inherited CookieStore methods. |
81 void SetCookieWithOptionsAsync(const GURL& url, | 85 void SetCookieWithOptionsAsync(const GURL& url, |
82 const std::string& cookie_line, | 86 const std::string& cookie_line, |
83 const net::CookieOptions& options, | 87 const net::CookieOptions& options, |
84 const SetCookiesCallback& callback) override { | 88 const SetCookiesCallback& callback) override { |
85 RoundTrip(); | 89 RoundTrip(); |
86 store_->SetCookieWithOptionsAsync(url, cookie_line, options, callback); | 90 store_->SetCookieWithOptionsAsync(url, cookie_line, options, callback); |
87 } | 91 } |
88 | 92 |
89 void SetCookieWithDetailsAsync(const GURL& url, | 93 void SetCookieWithDetailsAsync(const GURL& url, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 store_->FlushStore(callback); | 172 store_->FlushStore(callback); |
169 } | 173 } |
170 | 174 |
171 scoped_ptr<CookieStore::CookieChangedSubscription> AddCallbackForCookie( | 175 scoped_ptr<CookieStore::CookieChangedSubscription> AddCallbackForCookie( |
172 const GURL& url, | 176 const GURL& url, |
173 const std::string& name, | 177 const std::string& name, |
174 const CookieChangedCallback& callback) override { | 178 const CookieChangedCallback& callback) override { |
175 return scoped_ptr<CookieStore::CookieChangedSubscription>(); | 179 return scoped_ptr<CookieStore::CookieChangedSubscription>(); |
176 } | 180 } |
177 | 181 |
178 protected: | |
179 ~RoundTripTestCookieStore() override { store_->UnSynchronize(); } | |
180 | |
181 private: | 182 private: |
182 void RoundTrip() { | 183 void RoundTrip() { |
183 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store_.get()); | 184 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store_.get()); |
184 // Check that the system store is empty, because it is synchronized with | 185 // Check that the system store is empty, because it is synchronized with |
185 // |dummy_store_| which is empty. | 186 // |dummy_store_| which is empty. |
186 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 187 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
187 EXPECT_EQ(0u, [[store cookies] count]); | 188 EXPECT_EQ(0u, [[store cookies] count]); |
188 CookieStoreIOS::SwitchSynchronizedStore(dummy_store_.get(), store_.get()); | 189 CookieStoreIOS::SwitchSynchronizedStore(dummy_store_.get(), store_.get()); |
189 } | 190 } |
190 | 191 |
191 scoped_refptr<CookieStoreIOS> store_; | 192 scoped_ptr<CookieStoreIOS> store_; |
192 // |dummy_store_| is not directly used, but is needed to make |store_| | 193 // |dummy_store_| is not directly used, but is needed to make |store_| |
193 // inactive. | 194 // inactive. |
194 scoped_refptr<CookieStoreIOS> dummy_store_; | 195 scoped_ptr<CookieStoreIOS> dummy_store_; |
195 }; | 196 }; |
196 | 197 |
197 struct RoundTripTestCookieStoreTraits { | 198 struct RoundTripTestCookieStoreTraits { |
198 static scoped_refptr<net::CookieStore> Create() { | 199 static scoped_ptr<net::CookieStore> Create() { |
199 ClearCookies(); | 200 ClearCookies(); |
200 return new RoundTripTestCookieStore(); | 201 return make_scoped_ptr(new RoundTripTestCookieStore()); |
201 } | 202 } |
202 | 203 |
203 static const bool is_cookie_monster = false; | 204 static const bool is_cookie_monster = false; |
204 static const bool supports_http_only = false; | 205 static const bool supports_http_only = false; |
205 static const bool supports_non_dotted_domains = false; | 206 static const bool supports_non_dotted_domains = false; |
206 static const bool preserves_trailing_dots = false; | 207 static const bool preserves_trailing_dots = false; |
207 static const bool filters_schemes = false; | 208 static const bool filters_schemes = false; |
208 static const bool has_path_prefix_bug = true; | 209 static const bool has_path_prefix_bug = true; |
209 static const int creation_time_granularity_in_ms = 1000; | 210 static const int creation_time_granularity_in_ms = 1000; |
210 static const int enforces_prefixes = true; | 211 static const int enforces_prefixes = true; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 356 } |
356 | 357 |
357 } // namespace | 358 } // namespace |
358 | 359 |
359 class CookieStoreIOSWithBackend : public testing::Test { | 360 class CookieStoreIOSWithBackend : public testing::Test { |
360 public: | 361 public: |
361 CookieStoreIOSWithBackend() | 362 CookieStoreIOSWithBackend() |
362 : kTestCookieURL("http://foo.google.com/bar"), | 363 : kTestCookieURL("http://foo.google.com/bar"), |
363 kTestCookieURL2("http://foo.google.com/baz"), | 364 kTestCookieURL2("http://foo.google.com/baz"), |
364 kTestCookieURL3("http://foo.google.com"), | 365 kTestCookieURL3("http://foo.google.com"), |
365 kTestCookieURL4("http://bar.google.com/bar") { | 366 kTestCookieURL4("http://bar.google.com/bar"), |
366 backend_ = new TestPersistentCookieStore; | 367 backend_(new TestPersistentCookieStore), |
367 store_ = new net::CookieStoreIOS(backend_.get()); | 368 store_(new net::CookieStoreIOS(backend_.get())) { |
368 net::CookieStoreIOS::SetCookiePolicy(net::CookieStoreIOS::ALLOW); | 369 net::CookieStoreIOS::SetCookiePolicy(net::CookieStoreIOS::ALLOW); |
369 cookie_changed_callback_ = store_->AddCallbackForCookie( | 370 cookie_changed_callback_ = store_->AddCallbackForCookie( |
370 kTestCookieURL, "abc", | 371 kTestCookieURL, "abc", |
371 base::Bind(&RecordCookieChanges, &cookies_changed_, &cookies_removed_)); | 372 base::Bind(&RecordCookieChanges, &cookies_changed_, &cookies_removed_)); |
372 } | 373 } |
373 | 374 |
374 ~CookieStoreIOSWithBackend() override {} | 375 ~CookieStoreIOSWithBackend() override {} |
375 | 376 |
376 // Gets the cookies. |callback| will be called on completion. | 377 // Gets the cookies. |callback| will be called on completion. |
377 void GetCookies(const net::CookieStore::GetCookiesCallback& callback) { | 378 void GetCookies(const net::CookieStore::GetCookiesCallback& callback) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 423 } |
423 | 424 |
424 protected: | 425 protected: |
425 const GURL kTestCookieURL; | 426 const GURL kTestCookieURL; |
426 const GURL kTestCookieURL2; | 427 const GURL kTestCookieURL2; |
427 const GURL kTestCookieURL3; | 428 const GURL kTestCookieURL3; |
428 const GURL kTestCookieURL4; | 429 const GURL kTestCookieURL4; |
429 | 430 |
430 base::MessageLoop loop_; | 431 base::MessageLoop loop_; |
431 scoped_refptr<TestPersistentCookieStore> backend_; | 432 scoped_refptr<TestPersistentCookieStore> backend_; |
432 scoped_refptr<net::CookieStoreIOS> store_; | 433 scoped_ptr<net::CookieStoreIOS> store_; |
433 scoped_ptr<net::CookieStore::CookieChangedSubscription> | 434 scoped_ptr<net::CookieStore::CookieChangedSubscription> |
434 cookie_changed_callback_; | 435 cookie_changed_callback_; |
435 std::vector<net::CanonicalCookie> cookies_changed_; | 436 std::vector<net::CanonicalCookie> cookies_changed_; |
436 std::vector<bool> cookies_removed_; | 437 std::vector<bool> cookies_removed_; |
437 }; | 438 }; |
438 | 439 |
439 } // namespace | 440 } // namespace |
440 | 441 |
441 namespace net { | 442 namespace net { |
442 | 443 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 EXPECT_EQ(1U, cookies_changed_.size()); | 523 EXPECT_EQ(1U, cookies_changed_.size()); |
523 SetCookie("abc=def"); | 524 SetCookie("abc=def"); |
524 EXPECT_EQ(1U, cookies_changed_.size()); | 525 EXPECT_EQ(1U, cookies_changed_.size()); |
525 store_->UnSynchronize(); | 526 store_->UnSynchronize(); |
526 } | 527 } |
527 | 528 |
528 TEST(CookieStoreIOS, GetAllCookiesForURLAsync) { | 529 TEST(CookieStoreIOS, GetAllCookiesForURLAsync) { |
529 base::MessageLoop loop; | 530 base::MessageLoop loop; |
530 const GURL kTestCookieURL("http://foo.google.com/bar"); | 531 const GURL kTestCookieURL("http://foo.google.com/bar"); |
531 ClearCookies(); | 532 ClearCookies(); |
532 scoped_refptr<CookieStoreIOS> cookie_store(new CookieStoreIOS(nullptr)); | 533 scoped_ptr<CookieStoreIOS> cookie_store(new CookieStoreIOS(nullptr)); |
533 CookieStoreIOS::SwitchSynchronizedStore(nullptr, cookie_store.get()); | 534 CookieStoreIOS::SwitchSynchronizedStore(nullptr, cookie_store.get()); |
534 // Add a cookie. | 535 // Add a cookie. |
535 net::CookieOptions options; | 536 net::CookieOptions options; |
536 options.set_include_httponly(); | 537 options.set_include_httponly(); |
537 cookie_store->SetCookieWithOptionsAsync( | 538 cookie_store->SetCookieWithOptionsAsync( |
538 kTestCookieURL, "a=b", options, net::CookieStore::SetCookiesCallback()); | 539 kTestCookieURL, "a=b", options, net::CookieStore::SetCookiesCallback()); |
539 // Disallow cookies. | 540 // Disallow cookies. |
540 CookieStoreIOS::SetCookiePolicy(CookieStoreIOS::BLOCK); | 541 CookieStoreIOS::SetCookiePolicy(CookieStoreIOS::BLOCK); |
541 // No cookie in the system store. | 542 // No cookie in the system store. |
542 NSHTTPCookieStorage* system_store = | 543 NSHTTPCookieStorage* system_store = |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 backend_->RunLoadedCallback(); | 601 backend_->RunLoadedCallback(); |
601 EXPECT_TRUE(callback.did_run()); | 602 EXPECT_TRUE(callback.did_run()); |
602 EXPECT_EQ("a=b", callback.cookie_line()); | 603 EXPECT_EQ("a=b", callback.cookie_line()); |
603 store_->UnSynchronize(); | 604 store_->UnSynchronize(); |
604 } | 605 } |
605 | 606 |
606 // Tests that Synchronization can be "aborted" (i.e. the cookie store is | 607 // Tests that Synchronization can be "aborted" (i.e. the cookie store is |
607 // unsynchronized while synchronization is in progress). | 608 // unsynchronized while synchronization is in progress). |
608 TEST_F(CookieStoreIOSWithBackend, SyncThenUnsync) { | 609 TEST_F(CookieStoreIOSWithBackend, SyncThenUnsync) { |
609 ClearCookies(); | 610 ClearCookies(); |
610 scoped_refptr<CookieStoreIOS> dummy_store = new CookieStoreIOS(nullptr); | 611 scoped_ptr<CookieStoreIOS> dummy_store(new CookieStoreIOS(nullptr)); |
611 // Switch back and forth before synchronization can complete. | 612 // Switch back and forth before synchronization can complete. |
612 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 613 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
613 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); | 614 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); |
614 backend_->RunLoadedCallback(); | 615 backend_->RunLoadedCallback(); |
615 // No cookie leak in the system store. | 616 // No cookie leak in the system store. |
616 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 617 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
617 EXPECT_EQ(0u, [[store cookies] count]); | 618 EXPECT_EQ(0u, [[store cookies] count]); |
618 // No cookie lost. | 619 // No cookie lost. |
619 GetCookieCallback callback; | 620 GetCookieCallback callback; |
620 GetCookies(base::Bind(&GetCookieCallback::Run, base::Unretained(&callback))); | 621 GetCookies(base::Bind(&GetCookieCallback::Run, base::Unretained(&callback))); |
621 EXPECT_TRUE(callback.did_run()); | 622 EXPECT_TRUE(callback.did_run()); |
622 EXPECT_EQ("a=b", callback.cookie_line()); | 623 EXPECT_EQ("a=b", callback.cookie_line()); |
623 dummy_store->UnSynchronize(); | 624 dummy_store->UnSynchronize(); |
624 } | 625 } |
625 | 626 |
626 // Tests that Synchronization can be "aborted" while there are pending tasks | 627 // Tests that Synchronization can be "aborted" while there are pending tasks |
627 // (i.e. the cookie store is unsynchronized while synchronization is in progress | 628 // (i.e. the cookie store is unsynchronized while synchronization is in progress |
628 // and there are pending tasks). | 629 // and there are pending tasks). |
629 TEST_F(CookieStoreIOSWithBackend, SyncThenUnsyncWithPendingTasks) { | 630 TEST_F(CookieStoreIOSWithBackend, SyncThenUnsyncWithPendingTasks) { |
630 ClearCookies(); | 631 ClearCookies(); |
631 scoped_refptr<CookieStoreIOS> dummy_store = new CookieStoreIOS(nullptr); | 632 scoped_ptr<CookieStoreIOS> dummy_store(new CookieStoreIOS(nullptr)); |
632 // Start synchornization. | 633 // Start synchornization. |
633 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 634 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
634 // Create a pending task while synchronization is in progress. | 635 // Create a pending task while synchronization is in progress. |
635 GetCookieCallback callback; | 636 GetCookieCallback callback; |
636 GetCookies(base::Bind(&GetCookieCallback::Run, base::Unretained(&callback))); | 637 GetCookies(base::Bind(&GetCookieCallback::Run, base::Unretained(&callback))); |
637 // Cancel the synchronization. | 638 // Cancel the synchronization. |
638 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); | 639 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); |
639 // Synchronization completes after being cancelled. | 640 // Synchronization completes after being cancelled. |
640 backend_->RunLoadedCallback(); | 641 backend_->RunLoadedCallback(); |
641 // The task is not lost. | 642 // The task is not lost. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 720 } |
720 | 721 |
721 TEST_F(CookieStoreIOSWithBackend, FlushOnUnSynchronize) { | 722 TEST_F(CookieStoreIOSWithBackend, FlushOnUnSynchronize) { |
722 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 723 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
723 EXPECT_FALSE(backend_->flushed()); | 724 EXPECT_FALSE(backend_->flushed()); |
724 store_->UnSynchronize(); | 725 store_->UnSynchronize(); |
725 EXPECT_TRUE(backend_->flushed()); | 726 EXPECT_TRUE(backend_->flushed()); |
726 } | 727 } |
727 | 728 |
728 TEST_F(CookieStoreIOSWithBackend, FlushOnSwitch) { | 729 TEST_F(CookieStoreIOSWithBackend, FlushOnSwitch) { |
729 scoped_refptr<CookieStoreIOS> dummy_store = new CookieStoreIOS(nullptr); | 730 scoped_ptr<CookieStoreIOS> dummy_store(new CookieStoreIOS(nullptr)); |
730 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 731 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
731 EXPECT_FALSE(backend_->flushed()); | 732 EXPECT_FALSE(backend_->flushed()); |
732 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); | 733 CookieStoreIOS::SwitchSynchronizedStore(store_.get(), dummy_store.get()); |
733 EXPECT_TRUE(backend_->flushed()); | 734 EXPECT_TRUE(backend_->flushed()); |
734 dummy_store->UnSynchronize(); | 735 dummy_store->UnSynchronize(); |
735 } | 736 } |
736 | 737 |
737 TEST_F(CookieStoreIOSWithBackend, FlushOnCookieChanged) { | 738 TEST_F(CookieStoreIOSWithBackend, FlushOnCookieChanged) { |
738 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); | 739 CookieStoreIOS::SwitchSynchronizedStore(nullptr, store_.get()); |
739 store_->set_flush_delay_for_testing(base::TimeDelta()); | 740 store_->set_flush_delay_for_testing(base::TimeDelta()); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 EXPECT_EQ(2U, cookies.size()); | 986 EXPECT_EQ(2U, cookies.size()); |
986 // this deletes the callback | 987 // this deletes the callback |
987 handle.reset(); | 988 handle.reset(); |
988 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 989 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
989 EXPECT_EQ(2U, cookies.size()); | 990 EXPECT_EQ(2U, cookies.size()); |
990 DeleteSystemCookie(kTestCookieURL, "abc"); | 991 DeleteSystemCookie(kTestCookieURL, "abc"); |
991 store_->UnSynchronize(); | 992 store_->UnSynchronize(); |
992 } | 993 } |
993 | 994 |
994 } // namespace net | 995 } // namespace net |
OLD | NEW |