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

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

Issue 7541021: Update asynchronous CookieMonster API to login_utils. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/base/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_foo_, 1700 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_foo_,
1701 "A1=B; path=/foo;", 1701 "A1=B; path=/foo;",
1702 options)); 1702 options));
1703 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_bar_, 1703 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_bar_,
1704 "A2=D; path=/bar;", 1704 "A2=D; path=/bar;",
1705 options)); 1705 options));
1706 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_, 1706 EXPECT_TRUE(SetCookieWithOptions(cm_1.get(), url_google_,
1707 "A3=F;", 1707 "A3=F;",
1708 options)); 1708 options));
1709 1709
1710 CookieList cookies_1 = GetAllCookies(cm_1);
1710 scoped_refptr<CookieMonster> cm_2(new CookieMonster(NULL, NULL)); 1711 scoped_refptr<CookieMonster> cm_2(new CookieMonster(NULL, NULL));
1711 ASSERT_TRUE(cm_2->InitializeFrom(cm_1.get())); 1712 ASSERT_TRUE(cm_2->InitializeFrom(cookies_1));
1712 CookieList cookies = cm_2->GetAllCookies(); 1713 CookieList cookies_2 = GetAllCookies(cm_2);
1713 1714
1714 size_t expected_size = 3; 1715 size_t expected_size = 3;
1715 EXPECT_EQ(expected_size, cookies.size()); 1716 EXPECT_EQ(expected_size, cookies_2.size());
1716 1717
1717 CookieList::iterator it = cookies.begin(); 1718 CookieList::iterator it = cookies_2.begin();
1718 1719
1719 ASSERT_TRUE(it != cookies.end()); 1720 ASSERT_TRUE(it != cookies_2.end());
1720 EXPECT_EQ("A1", it->Name()); 1721 EXPECT_EQ("A1", it->Name());
1721 EXPECT_EQ("/foo", it->Path()); 1722 EXPECT_EQ("/foo", it->Path());
1722 1723
1723 ASSERT_TRUE(++it != cookies.end()); 1724 ASSERT_TRUE(++it != cookies_2.end());
1724 EXPECT_EQ("A2", it->Name()); 1725 EXPECT_EQ("A2", it->Name());
1725 EXPECT_EQ("/bar", it->Path()); 1726 EXPECT_EQ("/bar", it->Path());
1726 1727
1727 ASSERT_TRUE(++it != cookies.end()); 1728 ASSERT_TRUE(++it != cookies_2.end());
1728 EXPECT_EQ("A3", it->Name()); 1729 EXPECT_EQ("A3", it->Name());
1729 EXPECT_EQ("/", it->Path()); 1730 EXPECT_EQ("/", it->Path());
1730 } 1731 }
1731 1732
1732 1733
1733 // Test that overwriting persistent cookies deletes the old one from the 1734 // Test that overwriting persistent cookies deletes the old one from the
1734 // backing store. 1735 // backing store.
1735 TEST_F(CookieMonsterTest, OverwritePersistentCookie) { 1736 TEST_F(CookieMonsterTest, OverwritePersistentCookie) {
1736 GURL url_google("http://www.google.com/"); 1737 GURL url_google("http://www.google.com/");
1737 GURL url_chromium("http://chromium.org"); 1738 GURL url_chromium("http://chromium.org");
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 base::Closure task = base::Bind( 3017 base::Closure task = base::Bind(
3017 &net::MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask, 3018 &net::MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask,
3018 base::Unretained(this), 3019 base::Unretained(this),
3019 cm, *it, &callback); 3020 cm, *it, &callback);
3020 RunOnOtherThread(task); 3021 RunOnOtherThread(task);
3021 EXPECT_TRUE(callback.did_run()); 3022 EXPECT_TRUE(callback.did_run());
3022 EXPECT_TRUE(callback.result()); 3023 EXPECT_TRUE(callback.result());
3023 } 3024 }
3024 3025
3025 } // namespace net 3026 } // namespace net
OLDNEW
« no previous file with comments | « net/base/cookie_monster.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698