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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 void TestPriorityAwareGarbageCollectHelper() { | 565 void TestPriorityAwareGarbageCollectHelper() { |
566 // Hard-coding limits in the test, but use DCHECK_EQ to enforce constraint. | 566 // Hard-coding limits in the test, but use DCHECK_EQ to enforce constraint. |
567 DCHECK_EQ(180U, CookieMonster::kDomainMaxCookies); | 567 DCHECK_EQ(180U, CookieMonster::kDomainMaxCookies); |
568 DCHECK_EQ(150U, CookieMonster::kDomainMaxCookies - | 568 DCHECK_EQ(150U, CookieMonster::kDomainMaxCookies - |
569 CookieMonster::kDomainPurgeCookies); | 569 CookieMonster::kDomainPurgeCookies); |
570 DCHECK_EQ(30U, CookieMonster::kDomainCookiesQuotaLow); | 570 DCHECK_EQ(30U, CookieMonster::kDomainCookiesQuotaLow); |
571 DCHECK_EQ(50U, CookieMonster::kDomainCookiesQuotaMedium); | 571 DCHECK_EQ(50U, CookieMonster::kDomainCookiesQuotaMedium); |
572 DCHECK_EQ(70U, CookieMonster::kDomainCookiesQuotaHigh); | 572 DCHECK_EQ(70U, CookieMonster::kDomainCookiesQuotaHigh); |
573 | 573 |
574 scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL)); | 574 scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL)); |
575 cm->SetPriorityAwareGarbageCollection(true); | |
576 | 575 |
577 // Each test case adds 181 cookies, so 31 cookies are evicted. | 576 // Each test case adds 181 cookies, so 31 cookies are evicted. |
578 // Cookie same priority, repeated for each priority. | 577 // Cookie same priority, repeated for each priority. |
579 TestPriorityCookieCase(cm.get(), "181L", 150U, 0U, 0U); | 578 TestPriorityCookieCase(cm.get(), "181L", 150U, 0U, 0U); |
580 TestPriorityCookieCase(cm.get(), "181M", 0U, 150U, 0U); | 579 TestPriorityCookieCase(cm.get(), "181M", 0U, 150U, 0U); |
581 TestPriorityCookieCase(cm.get(), "181H", 0U, 0U, 150U); | 580 TestPriorityCookieCase(cm.get(), "181H", 0U, 0U, 150U); |
582 | 581 |
583 // Pairwise scenarios. | 582 // Pairwise scenarios. |
584 // Round 1 => none; round2 => 31M; round 3 => none. | 583 // Round 1 => none; round2 => 31M; round 3 => none. |
585 TestPriorityCookieCase(cm.get(), "10H 171M", 0U, 140U, 10U); | 584 TestPriorityCookieCase(cm.get(), "10H 171M", 0U, 140U, 10U); |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 | 2717 |
2719 // Inject our initial cookies into the mock PersistentCookieStore. | 2718 // Inject our initial cookies into the mock PersistentCookieStore. |
2720 store->SetLoadExpectation(true, initial_cookies); | 2719 store->SetLoadExpectation(true, initial_cookies); |
2721 | 2720 |
2722 scoped_refptr<CookieMonster> cm(new CookieMonster(store.get(), NULL)); | 2721 scoped_refptr<CookieMonster> cm(new CookieMonster(store.get(), NULL)); |
2723 | 2722 |
2724 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); | 2723 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); |
2725 } | 2724 } |
2726 | 2725 |
2727 } // namespace net | 2726 } // namespace net |
OLD | NEW |