1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.adservices.customaudience;
18 
19 import android.adservices.common.AdTechIdentifier;
20 import android.adservices.common.CommonFixture;
21 import android.net.Uri;
22 
23 import com.google.common.collect.ImmutableList;
24 
25 import java.util.ArrayList;
26 import java.util.List;
27 
28 /** Utility class supporting custom audience API unit tests */
29 public class TrustedBiddingDataFixture {
30     public static final String VALID_TRUSTED_BIDDING_URI_PATH = "/trusted/bidding/";
31 
32     public static final ImmutableList<String> VALID_TRUSTED_BIDDING_KEYS =
33             ImmutableList.of("example", "valid", "list", "of", "keys");
34 
getValidTrustedBiddingKeys()35     public static List<String> getValidTrustedBiddingKeys() {
36         return new ArrayList<>(VALID_TRUSTED_BIDDING_KEYS);
37     }
38 
getValidTrustedBiddingUriByBuyer(AdTechIdentifier buyer)39     public static Uri getValidTrustedBiddingUriByBuyer(AdTechIdentifier buyer) {
40         return CommonFixture.getUri(buyer, VALID_TRUSTED_BIDDING_URI_PATH);
41     }
42 
getValidTrustedBiddingDataByBuyer(AdTechIdentifier buyer)43     public static TrustedBiddingData getValidTrustedBiddingDataByBuyer(AdTechIdentifier buyer) {
44         return new TrustedBiddingData.Builder()
45                 .setTrustedBiddingKeys(getValidTrustedBiddingKeys())
46                 .setTrustedBiddingUri(getValidTrustedBiddingUriByBuyer(buyer))
47                 .build();
48     }
49 }
50