Merge "Add assertNoCallbackThat"
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
index 1b3d0f6..7d851f1 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
@@ -116,6 +116,7 @@
     val mark get() = history.mark
 
     override fun onAvailable(network: Network) {
+        Log.d(TAG, "onAvailable $network")
         history.add(Available(network))
     }
 
@@ -199,6 +200,15 @@
         if (null != cb) fail("Expected no callback but got $cb")
     }
 
+    fun assertNoCallbackThat(
+        timeoutMs: Long = defaultTimeoutMs,
+        valid: (CallbackEntry) -> Boolean
+    ) {
+        val cb = history.poll(timeoutMs) { valid(it) }.let {
+            if (null != it) fail("Expected no callback but got $it")
+        }
+    }
+
     // Expects a callback of the specified type on the specified network within the timeout.
     // If no callback arrives, or a different callback arrives, fail. Returns the callback.
     inline fun <reified T : CallbackEntry> expectCallback(