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

Commit 92abd28c authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Split test utilities into host and device-only"

parents f3f5f36d 418adbb4
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -14,6 +14,19 @@
// limitations under the License.
//

java_library {
    name: "net-tests-utils-multivariant",
    srcs: [
        "multivariant/**/*.java",
        "multivariant/**/*.kt",
    ],
    host_supported: true,
    static_libs: [
        "kotlin-test",
        "junit",
    ],
}

java_library {
    name: "net-tests-utils",
    srcs: [
@@ -22,8 +35,7 @@ java_library {
    ],
    defaults: ["lib_mockito_extended"],
    static_libs: [
        "kotlin-test",
        "junit",
        "net-tests-utils-multivariant",
    ],
}

+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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 com.android.testutils

// This function is private because the 2 is hardcoded here, and is not correct if not called
+0 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.testutils

import android.util.Log
import com.android.testutils.ExceptionUtils.ThrowingRunnable
import java.lang.reflect.Modifier
import kotlin.system.measureTimeMillis
@@ -80,7 +79,6 @@ fun assertRunsInAtMost(descr: String, timeLimit: Long, fn: Runnable) {
fun assertRunsInAtMost(descr: String, timeLimit: Long, fn: () -> Unit) {
    val timeTaken = measureTimeMillis(fn)
    val msg = String.format("%s: took %dms, limit was %dms", descr, timeTaken, timeLimit)
    Log.d(TAG, msg)
    assertTrue(timeTaken <= timeLimit, msg)
}

Loading