OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/browsing_data_cookie_helper.h" |
| 6 |
| 7 #include "chrome/test/testing_browser_process_test.h" |
| 8 #include "chrome/test/testing_profile.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 namespace { |
| 12 |
| 13 typedef TestingBrowserProcessTest CannedBrowsingDataCookieTest; |
| 14 |
| 15 TEST_F(CannedBrowsingDataCookieTest, Empty) { |
| 16 TestingProfile profile; |
| 17 |
| 18 const GURL url_google("http://www.google.com"); |
| 19 |
| 20 scoped_refptr<CannedBrowsingDataCookieHelper> helper( |
| 21 new CannedBrowsingDataCookieHelper(&profile)); |
| 22 |
| 23 ASSERT_TRUE(helper->empty()); |
| 24 helper->AddChangeCookie(url_google, "a=1", |
| 25 net::CookieOptions()); |
| 26 ASSERT_FALSE(helper->empty()); |
| 27 helper->Reset(); |
| 28 ASSERT_TRUE(helper->empty()); |
| 29 |
| 30 net::CookieList cookies; |
| 31 net::CookieMonster::ParsedCookie pc("a=1"); |
| 32 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie( |
| 33 new net::CookieMonster::CanonicalCookie(url_google, pc)); |
| 34 cookies.push_back(*cookie); |
| 35 |
| 36 helper->AddReadCookie(url_google, cookies); |
| 37 ASSERT_FALSE(helper->empty()); |
| 38 helper->Reset(); |
| 39 ASSERT_TRUE(helper->empty()); |
| 40 } |
| 41 |
| 42 } // namespace |
OLD | NEW |