OLD | NEW |
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_monster.h" | 5 #include "net/cookies/cookie_monster.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 const GURL test_url_; | 3357 const GURL test_url_; |
3358 | 3358 |
3359 private: | 3359 private: |
3360 scoped_refptr<MockPersistentCookieStore> store_; | 3360 scoped_refptr<MockPersistentCookieStore> store_; |
3361 std::unique_ptr<CookieMonster> monster_; | 3361 std::unique_ptr<CookieMonster> monster_; |
3362 }; | 3362 }; |
3363 | 3363 |
3364 void RecordCookieChanges(std::vector<CanonicalCookie>* out_cookies, | 3364 void RecordCookieChanges(std::vector<CanonicalCookie>* out_cookies, |
3365 std::vector<bool>* out_removes, | 3365 std::vector<bool>* out_removes, |
3366 const CanonicalCookie& cookie, | 3366 const CanonicalCookie& cookie, |
3367 bool removed) { | 3367 bool removed, |
| 3368 CookieStore::RemovalCause cause) { |
3368 DCHECK(out_cookies); | 3369 DCHECK(out_cookies); |
3369 out_cookies->push_back(cookie); | 3370 out_cookies->push_back(cookie); |
3370 if (out_removes) | 3371 if (out_removes) |
3371 out_removes->push_back(removed); | 3372 out_removes->push_back(removed); |
3372 } | 3373 } |
3373 | 3374 |
3374 TEST_F(CookieMonsterNotificationTest, NoNotifyWithNoCookie) { | 3375 TEST_F(CookieMonsterNotificationTest, NoNotifyWithNoCookie) { |
3375 std::vector<CanonicalCookie> cookies; | 3376 std::vector<CanonicalCookie> cookies; |
3376 std::unique_ptr<CookieStore::CookieChangedSubscription> sub( | 3377 std::unique_ptr<CookieStore::CookieChangedSubscription> sub( |
3377 monster()->AddCallbackForCookie( | 3378 monster()->AddCallbackForCookie( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 monster()->AddCallbackForCookie( | 3493 monster()->AddCallbackForCookie( |
3493 test_url_, "abc", | 3494 test_url_, "abc", |
3494 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3495 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
3495 SetCookie(monster(), test_url_, "abc=def"); | 3496 SetCookie(monster(), test_url_, "abc=def"); |
3496 base::RunLoop().RunUntilIdle(); | 3497 base::RunLoop().RunUntilIdle(); |
3497 EXPECT_EQ(1U, cookies0.size()); | 3498 EXPECT_EQ(1U, cookies0.size()); |
3498 EXPECT_EQ(1U, cookies0.size()); | 3499 EXPECT_EQ(1U, cookies0.size()); |
3499 } | 3500 } |
3500 | 3501 |
3501 } // namespace net | 3502 } // namespace net |
OLD | NEW |