blob: 0e7b815eb2c4eb7dcfd7e458919d9ebcecbd5e01 (
plain)
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
75
76
77
78
79
80
81
82
83
|
// Copyright 2018 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_cryptauth_device_manager.h"
#include <memory>
namespace cryptauth {
FakeCryptAuthDeviceManager::FakeCryptAuthDeviceManager() = default;
FakeCryptAuthDeviceManager::~FakeCryptAuthDeviceManager() = default;
void FakeCryptAuthDeviceManager::FinishActiveSync(
SyncResult sync_result,
DeviceChangeResult device_change_result,
const base::Time& sync_finish_time) {
DCHECK(is_sync_in_progress_);
is_sync_in_progress_ = false;
if (sync_result == CryptAuthDeviceManager::SyncResult::SUCCESS) {
last_sync_time_ = sync_finish_time;
is_recovering_from_failure_ = false;
} else {
is_recovering_from_failure_ = true;
}
NotifySyncFinished(sync_result, device_change_result);
}
void FakeCryptAuthDeviceManager::Start() {
has_started_ = true;
}
void FakeCryptAuthDeviceManager::ForceSyncNow(
InvocationReason invocation_reason) {
is_sync_in_progress_ = true;
NotifySyncStarted();
}
base::Time FakeCryptAuthDeviceManager::GetLastSyncTime() const {
return last_sync_time_;
}
base::TimeDelta FakeCryptAuthDeviceManager::GetTimeToNextAttempt() const {
return time_to_next_attempt_;
}
bool FakeCryptAuthDeviceManager::IsSyncInProgress() const {
return is_sync_in_progress_;
}
bool FakeCryptAuthDeviceManager::IsRecoveringFromFailure() const {
return is_recovering_from_failure_;
}
std::vector<ExternalDeviceInfo> FakeCryptAuthDeviceManager::GetSyncedDevices()
const {
return synced_devices_;
}
std::vector<ExternalDeviceInfo> FakeCryptAuthDeviceManager::GetUnlockKeys()
const {
return unlock_keys_;
}
std::vector<ExternalDeviceInfo> FakeCryptAuthDeviceManager::GetPixelUnlockKeys()
const {
return pixel_unlock_keys_;
}
std::vector<ExternalDeviceInfo> FakeCryptAuthDeviceManager::GetTetherHosts()
const {
return tether_hosts_;
}
std::vector<ExternalDeviceInfo>
FakeCryptAuthDeviceManager::GetPixelTetherHosts() const {
return pixel_tether_hosts_;
}
} // namespace cryptauth
|