Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_channel_id_helper.cc
blobdd20a8c8f28771828e0e0da93c99aa5409f1ea21
1 // Copyright 2014 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.
5 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h"
7 #include "base/logging.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 MockBrowsingDataChannelIDHelper::MockBrowsingDataChannelIDHelper()
11 : BrowsingDataChannelIDHelper() {}
13 MockBrowsingDataChannelIDHelper::
14 ~MockBrowsingDataChannelIDHelper() {}
16 void MockBrowsingDataChannelIDHelper::StartFetching(
17 const FetchResultCallback& callback) {
18 ASSERT_FALSE(callback.is_null());
19 ASSERT_TRUE(callback_.is_null());
20 callback_ = callback;
23 void MockBrowsingDataChannelIDHelper::DeleteChannelID(
24 const std::string& server_id) {
25 ASSERT_FALSE(callback_.is_null());
26 ASSERT_TRUE(channel_ids_.find(server_id) != channel_ids_.end());
27 channel_ids_[server_id] = false;
30 void MockBrowsingDataChannelIDHelper::AddChannelIDSample(
31 const std::string& server_id) {
32 ASSERT_TRUE(channel_ids_.find(server_id) == channel_ids_.end());
33 channel_id_list_.push_back(
34 net::ChannelIDStore::ChannelID(
35 server_id, base::Time(), base::Time(), "key", "cert"));
36 channel_ids_[server_id] = true;
39 void MockBrowsingDataChannelIDHelper::Notify() {
40 net::ChannelIDStore::ChannelIDList channel_id_list;
41 for (net::ChannelIDStore::ChannelIDList::iterator i =
42 channel_id_list_.begin();
43 i != channel_id_list_.end(); ++i) {
44 if (channel_ids_[i->server_identifier()])
45 channel_id_list.push_back(*i);
47 callback_.Run(channel_id_list);
50 void MockBrowsingDataChannelIDHelper::Reset() {
51 for (std::map<const std::string, bool>::iterator i =
52 channel_ids_.begin();
53 i != channel_ids_.end(); ++i)
54 i->second = true;
57 bool MockBrowsingDataChannelIDHelper::AllDeleted() {
58 for (std::map<const std::string, bool>::const_iterator i =
59 channel_ids_.begin();
60 i != channel_ids_.end(); ++i)
61 if (i->second)
62 return false;
63 return true;