summaryrefslogtreecommitdiff
path: root/chromium/components/policy/core/common/cloud/mock_cloud_policy_service.cc
blob: 3bf61bc77ff6429953120cf2473a885ba44aa08d (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
// 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/policy/core/common/cloud/mock_cloud_policy_service.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"

namespace policy {

MockCloudPolicyService::MockCloudPolicyService(CloudPolicyClient* client,
                                               CloudPolicyStore* store)
    : CloudPolicyService(std::string(), std::string(), client, store) {
  // Besides recording the mock call, invoke real RefreshPolicy() method.
  // That way FetchPolicy() is called on the |client|.
  ON_CALL(*this, RefreshPolicy(testing::_))
      .WillByDefault(
          testing::Invoke(this, &MockCloudPolicyService::InvokeRefreshPolicy));
}

MockCloudPolicyService::~MockCloudPolicyService() = default;

void MockCloudPolicyService::InvokeRefreshPolicy(
    RefreshPolicyCallback callback) {
  CloudPolicyService::RefreshPolicy(std::move(callback));
}

MockCloudPolicyServiceObserver::MockCloudPolicyServiceObserver() = default;

MockCloudPolicyServiceObserver::~MockCloudPolicyServiceObserver() = default;

}  // namespace policy