1 // Copyright 2015 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 "components/proximity_auth/cryptauth/fake_cryptauth_gcm_manager.h"
7 namespace proximity_auth
{
9 FakeCryptAuthGCMManager::FakeCryptAuthGCMManager(
10 const std::string
& registration_id
)
11 : registration_in_progress_(false), registration_id_(registration_id
) {}
13 FakeCryptAuthGCMManager::~FakeCryptAuthGCMManager() {}
15 void FakeCryptAuthGCMManager::StartListening() {}
17 void FakeCryptAuthGCMManager::RegisterWithGCM() {
18 registration_in_progress_
= true;
21 std::string
FakeCryptAuthGCMManager::GetRegistrationId() {
22 return registration_id_
;
25 void FakeCryptAuthGCMManager::AddObserver(Observer
* observer
) {
26 observers_
.AddObserver(observer
);
29 void FakeCryptAuthGCMManager::RemoveObserver(Observer
* observer
) {
30 observers_
.RemoveObserver(observer
);
33 void FakeCryptAuthGCMManager::CompleteRegistration(
34 const std::string
& registration_id
) {
35 DCHECK(registration_in_progress_
);
36 registration_in_progress_
= false;
37 registration_id_
= registration_id
;
38 bool success
= !registration_id_
.empty();
39 FOR_EACH_OBSERVER(Observer
, observers_
, OnGCMRegistrationResult(success
));
42 void FakeCryptAuthGCMManager::PushReenrollMessage() {
43 FOR_EACH_OBSERVER(Observer
, observers_
, OnReenrollMessage());
46 void FakeCryptAuthGCMManager::PushResyncMessage() {
47 FOR_EACH_OBSERVER(Observer
, observers_
, OnResyncMessage());
50 } // namespace proximity_auth