diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 22:12:49 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 22:12:49 +0000 |
commit | 34a160dad4c51a0b16263a91722865a5a92df2eb (patch) | |
tree | cdf69aee87316cced9b3c94b0baef82d180d8cf0 /net/base/cookie_monster_perftest.cc | |
parent | 69401287af172586685346e5dd6b7e22b923f224 (diff) | |
download | chromium_src-34a160dad4c51a0b16263a91722865a5a92df2eb.zip chromium_src-34a160dad4c51a0b16263a91722865a5a92df2eb.tar.gz chromium_src-34a160dad4c51a0b16263a91722865a5a92df2eb.tar.bz2 |
MAC Cookies (patch 3 of N)
Prepare the cookie monster for MAC cookies. According to the perftests in this
patch, the change to the cookie monster has a small but measurable effect
(83.963ms => 88.299ms).
Review URL: http://codereview.chromium.org/6901147
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_monster_perftest.cc')
-rw-r--r-- | net/base/cookie_monster_perftest.cc | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/net/base/cookie_monster_perftest.cc b/net/base/cookie_monster_perftest.cc index 68ac4cc..cd2c35e 100644 --- a/net/base/cookie_monster_perftest.cc +++ b/net/base/cookie_monster_perftest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -102,6 +102,51 @@ TEST(CookieMonsterTest, TestAddCookieOnManyHosts) { timer3.Done(); } +TEST(CookieMonsterTest, TestGetCookiesWithOptions) { + scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL)); + std::string cookie(kCookieLine); + std::vector<GURL> gurls; + for (int i = 0; i < kNumCookies; ++i) + gurls.push_back(GURL(base::StringPrintf("http://a%04d.izzle", i))); + + for (std::vector<GURL>::const_iterator it = gurls.begin(); + it != gurls.end(); ++it) { + EXPECT_TRUE(cm->SetCookie(*it, cookie)); + } + + PerfTimeLogger timer("Cookie_monster_get_cookie_info"); + for (std::vector<GURL>::const_iterator it = gurls.begin(); + it != gurls.end(); ++it) { + CookieOptions options; + std::string cookie_line; + cookie_line = cm->GetCookiesWithOptions(*it, options); + } + timer.Done(); +} + +TEST(CookieMonsterTest, TestGetCookiesWithInfo) { + scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL)); + std::string cookie(kCookieLine); + std::vector<GURL> gurls; + for (int i = 0; i < kNumCookies; ++i) + gurls.push_back(GURL(base::StringPrintf("http://a%04d.izzle", i))); + + for (std::vector<GURL>::const_iterator it = gurls.begin(); + it != gurls.end(); ++it) { + EXPECT_TRUE(cm->SetCookie(*it, cookie)); + } + + PerfTimeLogger timer("Cookie_monster_get_cookie_info"); + for (std::vector<GURL>::const_iterator it = gurls.begin(); + it != gurls.end(); ++it) { + CookieOptions options; + std::string cookie_line; + std::vector<CookieStore::CookieInfo> cookie_infos; + cm->GetCookiesWithInfo(*it, options, &cookie_line, &cookie_infos); + } + timer.Done(); +} + static int CountInString(const std::string& str, char c) { return std::count(str.begin(), str.end(), c); } |