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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 monster()->AddCallbackForCookie( | 3207 monster()->AddCallbackForCookie( |
3207 test_url_, "abc", | 3208 test_url_, "abc", |
3208 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3209 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
3209 SetCookie(monster(), test_url_, "abc=def"); | 3210 SetCookie(monster(), test_url_, "abc=def"); |
3210 base::MessageLoop::current()->RunUntilIdle(); | 3211 base::MessageLoop::current()->RunUntilIdle(); |
3211 EXPECT_EQ(1U, cookies0.size()); | 3212 EXPECT_EQ(1U, cookies0.size()); |
3212 EXPECT_EQ(1U, cookies0.size()); | 3213 EXPECT_EQ(1U, cookies0.size()); |
3213 } | 3214 } |
3214 | 3215 |
3215 } // namespace net | 3216 } // namespace net |
OLD | NEW |