Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 MockBrowsingDataChannelIDHelper::MockBrowsingDataChannelIDHelper() | |
| 10 : BrowsingDataChannelIDHelper() {} | |
| 11 | |
| 12 MockBrowsingDataChannelIDHelper:: | |
| 13 ~MockBrowsingDataChannelIDHelper() {} | |
| 14 | |
| 15 void MockBrowsingDataChannelIDHelper::StartFetching( | |
| 16 const FetchResultCallback& callback) { | |
| 17 callback_ = callback; | |
| 18 } | |
| 19 | |
| 20 void MockBrowsingDataChannelIDHelper::DeleteChannelID( | |
| 21 const std::string& server_id) { | |
| 22 CHECK(channel_ids_.find(server_id) != channel_ids_.end()); | |
| 23 channel_ids_[server_id] = false; | |
| 24 } | |
| 25 | |
| 26 void MockBrowsingDataChannelIDHelper::AddChannelIDSample( | |
| 27 const std::string& server_id) { | |
| 28 DCHECK(channel_ids_.find(server_id) == channel_ids_.end()); | |
| 29 channel_id_list_.push_back( | |
| 30 net::ChannelIDStore::ChannelID( | |
| 31 server_id, base::Time(), base::Time(), "key", "cert")); | |
| 32 channel_ids_[server_id] = true; | |
| 33 } | |
| 34 | |
| 35 void MockBrowsingDataChannelIDHelper::Notify() { | |
| 36 net::ChannelIDStore::ChannelIDList cert_list; | |
|
wtc
2014/07/01 19:50:49
cert_list => channel_id_list
Ryan Hamilton
2014/07/21 19:12:04
Done.
| |
| 37 for (net::ChannelIDStore::ChannelIDList::iterator i = | |
| 38 channel_id_list_.begin(); | |
| 39 i != channel_id_list_.end(); ++i) { | |
| 40 if (channel_ids_[i->server_identifier()]) | |
| 41 cert_list.push_back(*i); | |
| 42 } | |
| 43 callback_.Run(cert_list); | |
| 44 } | |
| 45 | |
| 46 void MockBrowsingDataChannelIDHelper::Reset() { | |
| 47 for (std::map<const std::string, bool>::iterator i = | |
| 48 channel_ids_.begin(); | |
| 49 i != channel_ids_.end(); ++i) | |
| 50 i->second = true; | |
| 51 } | |
| 52 | |
| 53 bool MockBrowsingDataChannelIDHelper::AllDeleted() { | |
| 54 for (std::map<const std::string, bool>::const_iterator i = | |
| 55 channel_ids_.begin(); | |
| 56 i != channel_ids_.end(); ++i) | |
| 57 if (i->second) | |
| 58 return false; | |
| 59 return true; | |
| 60 } | |
| OLD | NEW |