Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56099f59 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[Ravenwood] Remove RavenwoodFlagsValueProvider" into main

parents c43c3803 dc6fb613
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -182,21 +182,6 @@ java_device_for_host {
    visibility: [":__subpackages__"],
}

// Separated out from ravenwood-junit-impl since it needs to compile
// against `module_current`
java_library {
    name: "ravenwood-junit-impl-flag",
    srcs: [
        "junit-flag-src/**/*.java",
    ],
    sdk_version: "module_current",
    libs: [
        "junit",
        "flag-junit",
    ],
    visibility: ["//visibility:public"],
}

// Carefully compiles against only module_current to support tests that
// want to verify they're unbundled.  The "impl" library above is what
// ships inside the Ravenwood environment to actually drive any API
@@ -651,7 +636,6 @@ android_ravenwood_libgroup {
        "flag-junit",
        "ravenwood-framework",
        "ravenwood-junit-impl",
        "ravenwood-junit-impl-flag",
        "mockito-ravenwood-prebuilt",
        "inline-mockito-ravenwood-prebuilt",

+0 −54
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.platform.test.flag.junit;

import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.IFlagsValueProvider;

/**
 * Offer to create {@link CheckFlagsRule} instances that are useful on the Ravenwood deviceless
 * testing environment.
 *
 * At the moment, default flag values are not available on Ravenwood, so the only options offered
 * here are "all-on" and "all-off" options. Tests that want to exercise specific flag states should
 * use {@link android.platform.test.flag.junit.SetFlagsRule}.
 */
public class RavenwoodFlagsValueProvider {
    /**
     * Create a {@link CheckFlagsRule} instance where flags are in an "all-on" state.
     */
    public static CheckFlagsRule createAllOnCheckFlagsRule() {
        return new CheckFlagsRule(new IFlagsValueProvider() {
            @Override
            public boolean getBoolean(String flag) {
                return true;
            }
        });
    }

    /**
     * Create a {@link CheckFlagsRule} instance where flags are in an "all-off" state.
     */
    public static CheckFlagsRule createAllOffCheckFlagsRule() {
        return new CheckFlagsRule(new IFlagsValueProvider() {
            @Override
            public boolean getBoolean(String flag) {
                return false;
            }
        });
    }
}