Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: net/cookies/cookie_monster_unittest.cc

Issue 1767513004: Clean up cookie eviction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« net/cookies/cookie_monster.cc ('K') | « net/cookies/cookie_monster.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // high-priority cookies. 354 // high-priority cookies.
355 // Within each priority, only the least-accessed cookies should be evicted. 355 // Within each priority, only the least-accessed cookies should be evicted.
356 // Thus, to describe expected suriving cookies, it suffices to specify the 356 // Thus, to describe expected suriving cookies, it suffices to specify the
357 // expected population of surviving cookies per priority, i.e., 357 // expected population of surviving cookies per priority, i.e.,
358 // |expected_low_count|, |expected_medium_count|, and |expected_high_count|. 358 // |expected_low_count|, |expected_medium_count|, and |expected_high_count|.
359 void TestPriorityCookieCase(CookieMonster* cm, 359 void TestPriorityCookieCase(CookieMonster* cm,
360 const std::string& coded_priority_str, 360 const std::string& coded_priority_str,
361 size_t expected_low_count, 361 size_t expected_low_count,
362 size_t expected_medium_count, 362 size_t expected_medium_count,
363 size_t expected_high_count) { 363 size_t expected_high_count) {
364 SCOPED_TRACE(coded_priority_str);
364 this->DeleteAll(cm); 365 this->DeleteAll(cm);
365 int next_cookie_id = 0; 366 int next_cookie_id = 0;
366 std::vector<CookiePriority> priority_list; 367 std::vector<CookiePriority> priority_list;
367 std::vector<int> id_list[3]; // Indexed by CookiePriority. 368 std::vector<int> id_list[3]; // Indexed by CookiePriority.
368 369
369 // Parse |coded_priority_str| and add cookies. 370 // Parse |coded_priority_str| and add cookies.
370 for (const std::string& token : 371 for (const std::string& token :
371 base::SplitString(coded_priority_str, " ", base::TRIM_WHITESPACE, 372 base::SplitString(coded_priority_str, " ", base::TRIM_WHITESPACE,
372 base::SPLIT_WANT_ALL)) { 373 base::SPLIT_WANT_ALL)) {
373 DCHECK(!token.empty()); 374 DCHECK(!token.empty());
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 monster()->AddCallbackForCookie( 2994 monster()->AddCallbackForCookie(
2994 test_url_, "abc", 2995 test_url_, "abc",
2995 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); 2996 base::Bind(&RecordCookieChanges, &cookies1, nullptr)));
2996 SetCookie(monster(), test_url_, "abc=def"); 2997 SetCookie(monster(), test_url_, "abc=def");
2997 base::MessageLoop::current()->RunUntilIdle(); 2998 base::MessageLoop::current()->RunUntilIdle();
2998 EXPECT_EQ(1U, cookies0.size()); 2999 EXPECT_EQ(1U, cookies0.size());
2999 EXPECT_EQ(1U, cookies0.size()); 3000 EXPECT_EQ(1U, cookies0.size());
3000 } 3001 }
3001 3002
3002 } // namespace net 3003 } // namespace net
OLDNEW
« net/cookies/cookie_monster.cc ('K') | « net/cookies/cookie_monster.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698