| 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 "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/cookies/canonical_cookie.h" | |
| 10 #include "net/cookies/parsed_cookie.h" | 9 #include "net/cookies/parsed_cookie.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 MockBrowsingDataCookieHelper::MockBrowsingDataCookieHelper( | 12 MockBrowsingDataCookieHelper::MockBrowsingDataCookieHelper( |
| 14 net::URLRequestContextGetter* request_context_getter) | 13 net::URLRequestContextGetter* request_context_getter) |
| 15 : BrowsingDataCookieHelper(request_context_getter) { | 14 : BrowsingDataCookieHelper(request_context_getter) { |
| 16 } | 15 } |
| 17 | 16 |
| 18 MockBrowsingDataCookieHelper::~MockBrowsingDataCookieHelper() { | 17 MockBrowsingDataCookieHelper::~MockBrowsingDataCookieHelper() { |
| 19 } | 18 } |
| 20 | 19 |
| 21 void MockBrowsingDataCookieHelper::StartFetching( | 20 void MockBrowsingDataCookieHelper::StartFetching( |
| 22 const net::CookieMonster::GetCookieListCallback &callback) { | 21 const net::CookieStore::GetCookieListCallback &callback) { |
| 23 ASSERT_FALSE(callback.is_null()); | 22 ASSERT_FALSE(callback.is_null()); |
| 24 ASSERT_TRUE(callback_.is_null()); | 23 ASSERT_TRUE(callback_.is_null()); |
| 25 callback_ = callback; | 24 callback_ = callback; |
| 26 } | 25 } |
| 27 | 26 |
| 28 void MockBrowsingDataCookieHelper::DeleteCookie( | 27 void MockBrowsingDataCookieHelper::DeleteCookie( |
| 29 const net::CanonicalCookie& cookie) { | 28 const net::CanonicalCookie& cookie) { |
| 30 ASSERT_FALSE(callback_.is_null()); | 29 ASSERT_FALSE(callback_.is_null()); |
| 31 std::string key = cookie.Name() + "=" + cookie.Value(); | 30 std::string key = cookie.Name() + "=" + cookie.Value(); |
| 32 ASSERT_TRUE(ContainsKey(cookies_, key)); | 31 ASSERT_TRUE(ContainsKey(cookies_, key)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 60 pair.second = true; | 59 pair.second = true; |
| 61 } | 60 } |
| 62 | 61 |
| 63 bool MockBrowsingDataCookieHelper::AllDeleted() { | 62 bool MockBrowsingDataCookieHelper::AllDeleted() { |
| 64 for (const auto& pair : cookies_) { | 63 for (const auto& pair : cookies_) { |
| 65 if (pair.second) | 64 if (pair.second) |
| 66 return false; | 65 return false; |
| 67 } | 66 } |
| 68 return true; | 67 return true; |
| 69 } | 68 } |
| OLD | NEW |