OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" | 8 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::Unretained(this), | 83 base::Unretained(this), |
84 base::Unretained(profile_->GetRequestContext()), | 84 base::Unretained(profile_->GetRequestContext()), |
85 host, | 85 host, |
86 definition)); | 86 definition)); |
87 BlockUntilNotified(); | 87 BlockUntilNotified(); |
88 } | 88 } |
89 | 89 |
90 void RemoveCookieTester::GetCookieOnIOThread( | 90 void RemoveCookieTester::GetCookieOnIOThread( |
91 net::URLRequestContextGetter* context_getter, | 91 net::URLRequestContextGetter* context_getter, |
92 const std::string& host) { | 92 const std::string& host) { |
93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
94 net::CookieStore* cookie_store = context_getter-> | 94 net::CookieStore* cookie_store = context_getter-> |
95 GetURLRequestContext()->cookie_store(); | 95 GetURLRequestContext()->cookie_store(); |
96 cookie_store->GetCookiesWithOptionsAsync( | 96 cookie_store->GetCookiesWithOptionsAsync( |
97 GURL(host), net::CookieOptions(), | 97 GURL(host), net::CookieOptions(), |
98 base::Bind(&RemoveCookieTester::GetCookieCallback, | 98 base::Bind(&RemoveCookieTester::GetCookieCallback, |
99 base::Unretained(this))); | 99 base::Unretained(this))); |
100 } | 100 } |
101 | 101 |
102 void RemoveCookieTester::SetCookieOnIOThread( | 102 void RemoveCookieTester::SetCookieOnIOThread( |
103 net::URLRequestContextGetter* context_getter, | 103 net::URLRequestContextGetter* context_getter, |
104 const std::string& host, | 104 const std::string& host, |
105 const std::string& definition) { | 105 const std::string& definition) { |
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 106 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
107 net::CookieStore* cookie_store = context_getter-> | 107 net::CookieStore* cookie_store = context_getter-> |
108 GetURLRequestContext()->cookie_store(); | 108 GetURLRequestContext()->cookie_store(); |
109 cookie_store->SetCookieWithOptionsAsync( | 109 cookie_store->SetCookieWithOptionsAsync( |
110 GURL(host), definition, net::CookieOptions(), | 110 GURL(host), definition, net::CookieOptions(), |
111 base::Bind(&RemoveCookieTester::SetCookieCallback, | 111 base::Bind(&RemoveCookieTester::SetCookieCallback, |
112 base::Unretained(this))); | 112 base::Unretained(this))); |
113 } | 113 } |
114 | 114 |
115 void RemoveCookieTester::GetCookieCallback(const std::string& cookies) { | 115 void RemoveCookieTester::GetCookieCallback(const std::string& cookies) { |
116 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 116 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 RemoveCookieTester tester(browser()->profile()); | 165 RemoveCookieTester tester(browser()->profile()); |
166 tester.AddCookie(kCookieHostname, kCookieDefinition); | 166 tester.AddCookie(kCookieHostname, kCookieDefinition); |
167 ASSERT_EQ(kCookieDefinition, tester.GetCookie(kCookieHostname)); | 167 ASSERT_EQ(kCookieDefinition, tester.GetCookie(kCookieHostname)); |
168 | 168 |
169 ResetAndWait(ProfileResetter::COOKIES_AND_SITE_DATA); | 169 ResetAndWait(ProfileResetter::COOKIES_AND_SITE_DATA); |
170 | 170 |
171 EXPECT_EQ("", tester.GetCookie(kCookieHostname)); | 171 EXPECT_EQ("", tester.GetCookie(kCookieHostname)); |
172 } | 172 } |
173 | 173 |
174 } // namespace | 174 } // namespace |
OLD | NEW |