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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 CookieList list(GetAllCookies(cm.get())); | 1542 CookieList list(GetAllCookies(cm.get())); |
1543 EXPECT_EQ(2U, list.size()); | 1543 EXPECT_EQ(2U, list.size()); |
1544 // Confirm that we have one of each. | 1544 // Confirm that we have one of each. |
1545 std::string name1(list[0].Name()); | 1545 std::string name1(list[0].Name()); |
1546 std::string name2(list[1].Name()); | 1546 std::string name2(list[1].Name()); |
1547 EXPECT_TRUE(name1 == "X" || name2 == "X"); | 1547 EXPECT_TRUE(name1 == "X" || name2 == "X"); |
1548 EXPECT_TRUE(name1 == "Y" || name2 == "Y"); | 1548 EXPECT_TRUE(name1 == "Y" || name2 == "Y"); |
1549 EXPECT_NE(name1, name2); | 1549 EXPECT_NE(name1, name2); |
1550 } | 1550 } |
1551 | 1551 |
1552 TEST_F(CookieMonsterTest, Delegate) { | 1552 TEST_F(CookieMonsterTest, CookieMonsterDelegate) { |
1553 scoped_refptr<MockPersistentCookieStore> store( | 1553 scoped_refptr<MockPersistentCookieStore> store( |
1554 new MockPersistentCookieStore); | 1554 new MockPersistentCookieStore); |
1555 scoped_refptr<MockCookieMonsterDelegate> delegate( | 1555 scoped_refptr<MockCookieMonsterDelegate> delegate( |
1556 new MockCookieMonsterDelegate); | 1556 new MockCookieMonsterDelegate); |
1557 scoped_refptr<CookieMonster> cm( | 1557 scoped_refptr<CookieMonster> cm( |
1558 new CookieMonster(store.get(), delegate.get())); | 1558 new CookieMonster(store.get(), delegate.get())); |
1559 | 1559 |
1560 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "A=B")); | 1560 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "A=B")); |
1561 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "C=D")); | 1561 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "C=D")); |
1562 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "E=F")); | 1562 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "E=F")); |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); | 2679 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); |
2680 | 2680 |
2681 // Create some non-persistent cookies and check that they don't go to the | 2681 // Create some non-persistent cookies and check that they don't go to the |
2682 // persistent storage. | 2682 // persistent storage. |
2683 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); | 2683 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); |
2684 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); | 2684 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); |
2685 EXPECT_EQ(5u, store->commands().size()); | 2685 EXPECT_EQ(5u, store->commands().size()); |
2686 } | 2686 } |
2687 | 2687 |
2688 } // namespace net | 2688 } // namespace net |
OLD | NEW |