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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // brethren) with this one, and remove the 'New' prefix. | 43 // brethren) with this one, and remove the 'New' prefix. |
44 class NewMockPersistentCookieStore | 44 class NewMockPersistentCookieStore |
45 : public CookieMonster::PersistentCookieStore { | 45 : public CookieMonster::PersistentCookieStore { |
46 public: | 46 public: |
47 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback)); | 47 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback)); |
48 MOCK_METHOD2(LoadCookiesForKey, void(const std::string& key, | 48 MOCK_METHOD2(LoadCookiesForKey, void(const std::string& key, |
49 const LoadedCallback& loaded_callback)); | 49 const LoadedCallback& loaded_callback)); |
50 MOCK_METHOD1(AddCookie, void(const CanonicalCookie& cc)); | 50 MOCK_METHOD1(AddCookie, void(const CanonicalCookie& cc)); |
51 MOCK_METHOD1(UpdateCookieAccessTime, void(const CanonicalCookie& cc)); | 51 MOCK_METHOD1(UpdateCookieAccessTime, void(const CanonicalCookie& cc)); |
52 MOCK_METHOD1(DeleteCookie, void(const CanonicalCookie& cc)); | 52 MOCK_METHOD1(DeleteCookie, void(const CanonicalCookie& cc)); |
53 virtual void Flush(const base::Closure& callback) { | 53 MOCK_METHOD1(Flush, void(const base::Closure& callback)); |
54 if (!callback.is_null()) | |
55 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | |
56 } | |
57 MOCK_METHOD0(SetForceKeepSessionState, void()); | 54 MOCK_METHOD0(SetForceKeepSessionState, void()); |
58 | 55 |
59 private: | 56 private: |
60 virtual ~NewMockPersistentCookieStore() {} | 57 virtual ~NewMockPersistentCookieStore() {} |
61 }; | 58 }; |
62 | 59 |
63 const char* kTopLevelDomainPlus1 = "http://www.harvard.edu"; | 60 const char* kTopLevelDomainPlus1 = "http://www.harvard.edu"; |
64 const char* kTopLevelDomainPlus2 = "http://www.math.harvard.edu"; | 61 const char* kTopLevelDomainPlus2 = "http://www.math.harvard.edu"; |
65 const char* kTopLevelDomainPlus2Secure = "https://www.math.harvard.edu"; | 62 const char* kTopLevelDomainPlus2Secure = "https://www.math.harvard.edu"; |
66 const char* kTopLevelDomainPlus3 = | 63 const char* kTopLevelDomainPlus3 = |
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); | 2679 EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); |
2683 | 2680 |
2684 // 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 |
2685 // persistent storage. | 2682 // persistent storage. |
2686 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); | 2683 EXPECT_TRUE(SetCookie(cm.get(), url_google_, "B=Bar")); |
2687 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); | 2684 this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm.get(), url_google_)); |
2688 EXPECT_EQ(5u, store->commands().size()); | 2685 EXPECT_EQ(5u, store->commands().size()); |
2689 } | 2686 } |
2690 | 2687 |
2691 } // namespace net | 2688 } // namespace net |
OLD | NEW |