blob: b48de540ac0926799dda313062198dffd518fb20 [file] [log] [blame]
Yao Chen93fe3a32017-11-02 13:52:59 -07001// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14#pragma once
15
16#include "src/condition/ConditionWizard.h"
Chenjie Yu6736c892017-11-09 10:50:09 -080017#include "src/external/StatsPullerManager.h"
Chenjie Yu80f91122018-01-31 20:24:50 -080018#include "src/packages/UidMap.h"
Yao Chen93fe3a32017-11-02 13:52:59 -070019
20#include <gmock/gmock.h>
21#include <gtest/gtest.h>
22
23namespace android {
24namespace os {
25namespace statsd {
26
27class MockConditionWizard : public ConditionWizard {
28public:
Yangster-mac93694462018-01-22 20:49:31 -080029 MOCK_METHOD4(
Yao Chen93fe3a32017-11-02 13:52:59 -070030 query,
31 ConditionState(const int conditionIndex,
Yangster-mac93694462018-01-22 20:49:31 -080032 const ConditionKey& conditionParameters,
33 const FieldMatcher& dimensionFields,
34 std::unordered_set<HashableDimensionKey> *dimensionKeySet));
Yao Chen93fe3a32017-11-02 13:52:59 -070035};
36
Chenjie Yu6736c892017-11-09 10:50:09 -080037class MockStatsPullerManager : public StatsPullerManager {
38public:
39 MOCK_METHOD3(RegisterReceiver, void(int tagId, wp<PullDataReceiver> receiver, long intervalMs));
40 MOCK_METHOD2(UnRegisterReceiver, void(int tagId, wp<PullDataReceiver> receiver));
41 MOCK_METHOD2(Pull, bool(const int pullCode, vector<std::shared_ptr<LogEvent>>* data));
42};
43
Chenjie Yu80f91122018-01-31 20:24:50 -080044class MockUidMap : public UidMap {
45 public:
46 MOCK_CONST_METHOD1(getHostUidOrSelf, int(int uid));
47};
48
Yangster-mac20877162017-12-22 17:19:39 -080049HashableDimensionKey getMockedDimensionKey(int tagId, int key, std::string value);
Yangster-mac93694462018-01-22 20:49:31 -080050MetricDimensionKey getMockedMetricDimensionKey(int tagId, int key, std::string value);
Yao Chend5aa01b32017-12-19 16:46:36 -080051
Yao Chen93fe3a32017-11-02 13:52:59 -070052} // namespace statsd
53} // namespace os
Yao Chend5aa01b32017-12-19 16:46:36 -080054} // namespace android