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.adselection;
18 
19 import static com.android.adservices.service.adselection.AdSelectionScriptEngine.NUM_BITS_STOCHASTIC_ROUNDING;
20 
21 import android.adservices.common.AdTechIdentifier;
22 import android.net.Uri;
23 
24 import com.android.adservices.service.adselection.AdCost;
25 import com.android.adservices.service.adselection.BuyerContextualSignals;
26 
27 public class CustomAudienceBiddingInfoFixture {
28 
29     public static final String VALID_BIDDING_LOGIC_URI_FORMAT = "https://%s/bidding/logic/here/";
30 
31     public static final int DATA_VERSION_1 = 1;
32     public static final int DATA_VERSION_2 = 2;
33 
34     public static final String BUYER_DECISION_LOGIC_JS =
35             "function runBidding(ad_selection_signals, per_buyer_signals, signals_for_buyer,"
36                     + ") {;\n"
37                     + "}";
38 
39     public static final BuyerContextualSignals BUYER_CONTEXTUAL_SIGNALS_WITH_AD_COST =
40             BuyerContextualSignals.builder()
41                     .setAdCost(new AdCost(1.0, NUM_BITS_STOCHASTIC_ROUNDING))
42                     .build();
43 
44     public static final BuyerContextualSignals BUYER_CONTEXTUAL_SIGNALS_WITH_DATA_VERSION =
45             BuyerContextualSignals.builder().setDataVersion(DATA_VERSION_1).build();
46 
47     public static final BuyerContextualSignals BUYER_CONTEXTUAL_SIGNALS_All =
48             BuyerContextualSignals.builder()
49                     .setAdCost(new AdCost(1.0, NUM_BITS_STOCHASTIC_ROUNDING))
50                     .setDataVersion(DATA_VERSION_1)
51                     .build();
52 
getValidBiddingLogicUri(String buyer)53     public static Uri getValidBiddingLogicUri(String buyer) {
54         return Uri.parse(String.format(VALID_BIDDING_LOGIC_URI_FORMAT, buyer));
55     }
56 
getValidBiddingLogicUri(AdTechIdentifier buyer)57     public static Uri getValidBiddingLogicUri(AdTechIdentifier buyer) {
58         return getValidBiddingLogicUri(buyer.toString());
59     }
60 }
61