| 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 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2849 store->SetLoadExpectation(true, std::move(initial_cookies)); | 2849 store->SetLoadExpectation(true, std::move(initial_cookies)); |
| 2850 | 2850 |
| 2851 std::unique_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); | 2851 std::unique_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); |
| 2852 | 2852 |
| 2853 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); | 2853 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); |
| 2854 } | 2854 } |
| 2855 | 2855 |
| 2856 // Test that cookie source schemes are histogrammed correctly. | 2856 // Test that cookie source schemes are histogrammed correctly. |
| 2857 TEST_F(CookieMonsterTest, CookieSourceHistogram) { | 2857 TEST_F(CookieMonsterTest, CookieSourceHistogram) { |
| 2858 base::HistogramTester histograms; | 2858 base::HistogramTester histograms; |
| 2859 const std::string cookie_source_histogram = "Cookie.CookieSourceScheme"; | 2859 const std::string cookie_source_histogram = "Cookie.CookieSourceScheme2"; |
| 2860 | 2860 |
| 2861 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); | 2861 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); |
| 2862 std::unique_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); | 2862 std::unique_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); |
| 2863 | 2863 |
| 2864 histograms.ExpectTotalCount(cookie_source_histogram, 0); | 2864 histograms.ExpectTotalCount(cookie_source_histogram, 0); |
| 2865 | 2865 |
| 2866 // Set a secure cookie on a cryptographic scheme. | 2866 // Set a secure cookie on a cryptographic scheme. |
| 2867 EXPECT_TRUE( | 2867 EXPECT_TRUE( |
| 2868 SetCookie(cm.get(), https_www_google_.url(), "A=B; path=/; Secure")); | 2868 SetCookie(cm.get(), https_www_google_.url(), "A=B; path=/; Secure")); |
| 2869 histograms.ExpectTotalCount(cookie_source_histogram, 1); | 2869 histograms.ExpectTotalCount(cookie_source_histogram, 1); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3371 monster()->AddCallbackForCookie( | 3371 monster()->AddCallbackForCookie( |
| 3372 test_url_, "abc", | 3372 test_url_, "abc", |
| 3373 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3373 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
| 3374 SetCookie(monster(), test_url_, "abc=def"); | 3374 SetCookie(monster(), test_url_, "abc=def"); |
| 3375 base::RunLoop().RunUntilIdle(); | 3375 base::RunLoop().RunUntilIdle(); |
| 3376 EXPECT_EQ(1U, cookies0.size()); | 3376 EXPECT_EQ(1U, cookies0.size()); |
| 3377 EXPECT_EQ(1U, cookies0.size()); | 3377 EXPECT_EQ(1U, cookies0.size()); |
| 3378 } | 3378 } |
| 3379 | 3379 |
| 3380 } // namespace net | 3380 } // namespace net |
| OLD | NEW |