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 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3423 EXPECT_EQ(1U, cookies.size()); | 3423 EXPECT_EQ(1U, cookies.size()); |
3424 EXPECT_EQ(1U, causes.size()); | 3424 EXPECT_EQ(1U, causes.size()); |
3425 | 3425 |
3426 DeleteCookie(monster(), test_url_, "abc"); | 3426 DeleteCookie(monster(), test_url_, "abc"); |
3427 base::RunLoop().RunUntilIdle(); | 3427 base::RunLoop().RunUntilIdle(); |
3428 EXPECT_EQ(2U, cookies.size()); | 3428 EXPECT_EQ(2U, cookies.size()); |
3429 EXPECT_EQ(2U, causes.size()); | 3429 EXPECT_EQ(2U, causes.size()); |
3430 | 3430 |
3431 EXPECT_EQ("abc", cookies[1].Name()); | 3431 EXPECT_EQ("abc", cookies[1].Name()); |
3432 EXPECT_EQ("def", cookies[1].Value()); | 3432 EXPECT_EQ("def", cookies[1].Value()); |
3433 EXPECT_EQ(CookieStore::ChangeCause::EXPLICIT, causes[1]); | 3433 EXPECT_EQ(CookieStore::ChangeCause::EXPLICIT_DELETE, causes[1]); |
3434 } | 3434 } |
3435 | 3435 |
3436 TEST_F(CookieMonsterNotificationTest, NotifyOnUpdate) { | 3436 TEST_F(CookieMonsterNotificationTest, NotifyOnUpdate) { |
3437 std::vector<CanonicalCookie> cookies; | 3437 std::vector<CanonicalCookie> cookies; |
3438 std::vector<CookieStore::ChangeCause> causes; | 3438 std::vector<CookieStore::ChangeCause> causes; |
3439 std::unique_ptr<CookieStore::CookieChangedSubscription> sub( | 3439 std::unique_ptr<CookieStore::CookieChangedSubscription> sub( |
3440 monster()->AddCallbackForCookie( | 3440 monster()->AddCallbackForCookie( |
3441 test_url_, "abc", | 3441 test_url_, "abc", |
3442 base::Bind(&RecordCookieChanges, &cookies, &causes))); | 3442 base::Bind(&RecordCookieChanges, &cookies, &causes))); |
3443 SetCookie(monster(), test_url_, "abc=def"); | 3443 SetCookie(monster(), test_url_, "abc=def"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3493 monster()->AddCallbackForCookie( | 3493 monster()->AddCallbackForCookie( |
3494 test_url_, "abc", | 3494 test_url_, "abc", |
3495 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3495 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
3496 SetCookie(monster(), test_url_, "abc=def"); | 3496 SetCookie(monster(), test_url_, "abc=def"); |
3497 base::RunLoop().RunUntilIdle(); | 3497 base::RunLoop().RunUntilIdle(); |
3498 EXPECT_EQ(1U, cookies0.size()); | 3498 EXPECT_EQ(1U, cookies0.size()); |
3499 EXPECT_EQ(1U, cookies0.size()); | 3499 EXPECT_EQ(1U, cookies0.size()); |
3500 } | 3500 } |
3501 | 3501 |
3502 } // namespace net | 3502 } // namespace net |
OLD | NEW |