forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfake_software_feature_manager.cc
74 lines (61 loc) · 2.72 KB
/
fake_software_feature_manager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2017 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 "components/cryptauth/fake_software_feature_manager.h"
namespace cryptauth {
FakeSoftwareFeatureManager::SetSoftwareFeatureStateArgs::
SetSoftwareFeatureStateArgs(
const std::string& public_key,
SoftwareFeature software_feature,
bool enabled,
const base::Closure& success_callback,
const base::Callback<void(NetworkRequestError)>& error_callback,
bool is_exclusive)
: public_key(public_key),
software_feature(software_feature),
enabled(enabled),
success_callback(success_callback),
error_callback(error_callback),
is_exclusive(is_exclusive) {}
FakeSoftwareFeatureManager::SetSoftwareFeatureStateArgs::
~SetSoftwareFeatureStateArgs() = default;
FakeSoftwareFeatureManager::FindEligibleDevicesArgs::FindEligibleDevicesArgs(
SoftwareFeature software_feature,
const base::Callback<void(const std::vector<ExternalDeviceInfo>&,
const std::vector<IneligibleDevice>&)>&
success_callback,
const base::Callback<void(NetworkRequestError)>& error_callback)
: software_feature(software_feature),
success_callback(success_callback),
error_callback(error_callback) {}
FakeSoftwareFeatureManager::FindEligibleDevicesArgs::
~FindEligibleDevicesArgs() = default;
FakeSoftwareFeatureManager::FakeSoftwareFeatureManager() = default;
FakeSoftwareFeatureManager::~FakeSoftwareFeatureManager() = default;
void FakeSoftwareFeatureManager::SetSoftwareFeatureState(
const std::string& public_key,
SoftwareFeature software_feature,
bool enabled,
const base::Closure& success_callback,
const base::Callback<void(NetworkRequestError)>& error_callback,
bool is_exclusive) {
set_software_feature_state_calls_.emplace_back(
std::make_unique<SetSoftwareFeatureStateArgs>(
public_key, software_feature, enabled, success_callback,
error_callback, is_exclusive));
if (delegate_)
delegate_->OnSetSoftwareFeatureStateCalled();
}
void FakeSoftwareFeatureManager::FindEligibleDevices(
SoftwareFeature software_feature,
const base::Callback<void(const std::vector<ExternalDeviceInfo>&,
const std::vector<IneligibleDevice>&)>&
success_callback,
const base::Callback<void(NetworkRequestError)>& error_callback) {
find_eligible_multidevice_host_calls_.emplace_back(
std::make_unique<FindEligibleDevicesArgs>(
software_feature, success_callback, error_callback));
if (delegate_)
delegate_->OnFindEligibleDevicesCalled();
}
} // namespace cryptauth