1d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// Copyright (C) 2017 The Android Open Source Project
2d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen//
3d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// Licensed under the Apache License, Version 2.0 (the "License");
4d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// you may not use this file except in compliance with the License.
5d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// You may obtain a copy of the License at
6d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen//
7d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen//      http://www.apache.org/licenses/LICENSE-2.0
8d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen//
9d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// Unless required by applicable law or agreed to in writing, software
10d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// distributed under the License is distributed on an "AS IS" BASIS,
11d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// See the License for the specific language governing permissions and
13d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen// limitations under the License.
14d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen
15d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen#include "metrics_test_helper.h"
16d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen
17d5aa01b3716e07463019fa772f07a40613f9e39eYao Chennamespace android {
18d5aa01b3716e07463019fa772f07a40613f9e39eYao Chennamespace os {
19d5aa01b3716e07463019fa772f07a40613f9e39eYao Chennamespace statsd {
20d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen
212087716f2bdca90c7c3034d556ac12911bd8018eYangster-macHashableDimensionKey getMockedDimensionKey(int tagId, int key, string value) {
226b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    HashableDimensionKey dimension;
236b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    int pos[] = {key, 0, 0};
246b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    dimension.addValue(FieldValue(Field(tagId, pos, 0), Value(value)));
256b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen
266b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    return dimension;
27d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen}
28d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen
299369446f0b04945d6674550728ae81196d6fb5c2Yangster-macMetricDimensionKey getMockedMetricDimensionKey(int tagId, int key, string value) {
306b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    return MetricDimensionKey(getMockedDimensionKey(tagId, key, value), DEFAULT_DIMENSION_KEY);
316b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen}
326b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen
336b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chenvoid buildSimpleAtomFieldMatcher(const int tagId, FieldMatcher* matcher) {
346b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    matcher->set_field(tagId);
359369446f0b04945d6674550728ae81196d6fb5c2Yangster-mac}
366b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen
376b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chenvoid buildSimpleAtomFieldMatcher(const int tagId, const int fieldNum, FieldMatcher* matcher) {
386b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    matcher->set_field(tagId);
396b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen    matcher->add_child()->set_field(fieldNum);
406b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen}
416b1f5e8bafda6cdd5a6ddab9acb7e7d0398242f6Yao Chen
42d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen}  // namespace statsd
43d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen}  // namespace os
44d5aa01b3716e07463019fa772f07a40613f9e39eYao Chen}  // namespace android