1873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski/*
2873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * Copyright (C) 2017 The Android Open Source Project
3873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski *
4873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License");
5873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * you may not use this file except in compliance with the License.
6873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * You may obtain a copy of the License at
7873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski *
8873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski *      http://www.apache.org/licenses/LICENSE-2.0
9873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski *
10873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * Unless required by applicable law or agreed to in writing, software
11873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS,
12873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * See the License for the specific language governing permissions and
14873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski * limitations under the License.
15873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski */
16873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
17873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#ifndef ANDROIDFW_TEST_COMMON_HELPERS_H
18873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#define ANDROIDFW_TEST_COMMON_HELPERS_H
19873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
20873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#include <ostream>
21873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#include <string>
22873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
23873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#include "androidfw/ResourceTypes.h"
24873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#include "utils/String16.h"
25873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#include "utils/String8.h"
26873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
27873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskinamespace android {
28873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
29873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskivoid InitializeTest(int* argc, char** argv);
30873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
31873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskienum { MAY_NOT_BE_BAG = false };
32873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
33873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskivoid SetTestDataPath(const std::string& path);
34873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
35873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskiconst std::string& GetTestDataPath();
36873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
37873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskistd::string GetStringFromPool(const ResStringPool* pool, uint32_t idx);
38873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
39873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskistatic inline bool operator==(const ResTable_config& a, const ResTable_config& b) {
40873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski  return a.compare(b) == 0;
41873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski}
42873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
43873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskistatic inline ::std::ostream& operator<<(::std::ostream& out, const String8& str) {
44873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski  return out << str.string();
45873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski}
46873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
47873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskistatic inline ::std::ostream& operator<<(::std::ostream& out, const String16& str) {
48873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski  return out << String8(str).string();
49873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski}
50873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
51873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinskistatic inline ::std::ostream& operator<<(::std::ostream& out, const ResTable_config& c) {
52873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski  return out << c.toString();
53873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski}
54873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
55873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski}  // namespace android
56873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski
57873ef0e2302a1581dbcb83b49cefc95dcc41f5a0Adam Lesinski#endif  // ANDROIDFW_TEST_COMMON_HELPERS_H
58