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

Commit 07e4516c authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by android-build-merger
Browse files

Merge "Split test utilities into host and device-only" am: 92abd28c am: d41a62f3 am: 6257f1f0

am: 2fe97d0b

Change-Id: I6c3001ddb726443185fb5bc4cb336cca52dd496a
parents 900b19fa 2fe97d0b
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