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_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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 CookieList list(GetAllCookies(cm.get())); | 1528 CookieList list(GetAllCookies(cm.get())); |
1529 EXPECT_EQ(2U, list.size()); | 1529 EXPECT_EQ(2U, list.size()); |
1530 // Confirm that we have one of each. | 1530 // Confirm that we have one of each. |
1531 std::string name1(list[0].Name()); | 1531 std::string name1(list[0].Name()); |
1532 std::string name2(list[1].Name()); | 1532 std::string name2(list[1].Name()); |
1533 EXPECT_TRUE(name1 == "X" || name2 == "X"); | 1533 EXPECT_TRUE(name1 == "X" || name2 == "X"); |
1534 EXPECT_TRUE(name1 == "Y" || name2 == "Y"); | 1534 EXPECT_TRUE(name1 == "Y" || name2 == "Y"); |
1535 EXPECT_NE(name1, name2); | 1535 EXPECT_NE(name1, name2); |
1536 } | 1536 } |
1537 | 1537 |
1538 TEST_F(CookieMonsterTest, Delegate) { | 1538 TEST_F(CookieMonsterTest, CookieMonsterDelegate) { |
1539 scoped_refptr<MockPersistentCookieStore> store( | 1539 scoped_refptr<MockPersistentCookieStore> store( |
1540 new MockPersistentCookieStore); | 1540 new MockPersistentCookieStore); |
1541 scoped_refptr<MockCookieMonsterDelegate> delegate( | 1541 scoped_refptr<MockCookieMonsterDelegate> delegate( |
1542 new MockCookieMonsterDelegate); | 1542 new MockCookieMonsterDelegate); |
1543 scoped_refptr<CookieMonster> cm( | 1543 scoped_refptr<CookieMonster> cm( |
1544 new CookieMonster(store.get(), delegate.get())); | 1544 new CookieMonster(store.get(), delegate.get())); |
1545 | 1545 |
1546 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "A=B")); | 1546 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "A=B")); |
1547 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "C=D")); | 1547 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "C=D")); |
1548 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "E=F")); | 1548 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "E=F")); |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); | 2611 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); |
2612 | 2612 |
2613 // Create some non-persistent cookies and check that they don't go to the | 2613 // Create some non-persistent cookies and check that they don't go to the |
2614 // persistent storage. | 2614 // persistent storage. |
2615 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); | 2615 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); |
2616 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); | 2616 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); |
2617 EXPECT_EQ(5u, store->commands().size()); | 2617 EXPECT_EQ(5u, store->commands().size()); |
2618 } | 2618 } |
2619 | 2619 |
2620 } // namespace net | 2620 } // namespace net |
OLD | NEW |