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

Unified Diff: chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc

Issue 356713005: Rename ServerBoundCert => ChannelID to reflect the current name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cookies_list.js Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc
diff --git a/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2973bdfaa299c6778e0841540babf47d4e225feb
--- /dev/null
+++ b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h"
+
+#include "base/logging.h"
+
+MockBrowsingDataChannelIDHelper::MockBrowsingDataChannelIDHelper()
+ : BrowsingDataChannelIDHelper() {}
+
+MockBrowsingDataChannelIDHelper::
+~MockBrowsingDataChannelIDHelper() {}
+
+void MockBrowsingDataChannelIDHelper::StartFetching(
+ const FetchResultCallback& callback) {
+ callback_ = callback;
+}
+
+void MockBrowsingDataChannelIDHelper::DeleteChannelID(
+ const std::string& server_id) {
+ CHECK(channel_ids_.find(server_id) != channel_ids_.end());
+ channel_ids_[server_id] = false;
+}
+
+void MockBrowsingDataChannelIDHelper::AddChannelIDSample(
+ const std::string& server_id) {
+ DCHECK(channel_ids_.find(server_id) == channel_ids_.end());
+ channel_id_list_.push_back(
+ net::ChannelIDStore::ChannelID(
+ server_id, base::Time(), base::Time(), "key", "cert"));
+ channel_ids_[server_id] = true;
+}
+
+void MockBrowsingDataChannelIDHelper::Notify() {
+ net::ChannelIDStore::ChannelIDList channel_id_list;
+ for (net::ChannelIDStore::ChannelIDList::iterator i =
+ channel_id_list_.begin();
+ i != channel_id_list_.end(); ++i) {
+ if (channel_ids_[i->server_identifier()])
+ channel_id_list.push_back(*i);
+ }
+ callback_.Run(channel_id_list);
+}
+
+void MockBrowsingDataChannelIDHelper::Reset() {
+ for (std::map<const std::string, bool>::iterator i =
+ channel_ids_.begin();
+ i != channel_ids_.end(); ++i)
+ i->second = true;
+}
+
+bool MockBrowsingDataChannelIDHelper::AllDeleted() {
+ for (std::map<const std::string, bool>::const_iterator i =
+ channel_ids_.begin();
+ i != channel_ids_.end(); ++i)
+ if (i->second)
+ return false;
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698