CTS test unregisterAudioDeviceCallback.
Change-Id: Ib81a1855b8c37d092fc013e7719d305297da552b
diff --git a/tests/tests/media/src/android/media/cts/EnumDevicesTest.java b/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
index bf0d6cf..53dd5e6 100644
--- a/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
+++ b/tests/tests/media/src/android/media/cts/EnumDevicesTest.java
@@ -153,15 +153,33 @@
}
public void test_deviceCallback() {
+ // null callback?
mAudioManager.registerAudioDeviceCallback(null,null);
- assertTrue(true);
AudioDeviceCallback callback = new EmptyDeviceCallback();
+ AudioDeviceCallback someOtherCallback = new EmptyDeviceCallback();
+ // null Handler
mAudioManager.registerAudioDeviceCallback(callback, null);
- assertTrue(true);
+ // unregister null callback
+ mAudioManager.unregisterAudioDeviceCallback(null);
+ // unregister callback not registered
+ mAudioManager.unregisterAudioDeviceCallback(someOtherCallback);
+ // nominal case
+ mAudioManager.unregisterAudioDeviceCallback(callback);
+ // remove twice
+ mAudioManager.unregisterAudioDeviceCallback(callback);
+
+ // non-null Handler
mAudioManager.registerAudioDeviceCallback(callback, new Handler());
- assertTrue(true);
+ // unregister null callback
+ mAudioManager.unregisterAudioDeviceCallback(null);
+ // unregister callback not registered
+ mAudioManager.unregisterAudioDeviceCallback(someOtherCallback);
+ // nominal case
+ mAudioManager.unregisterAudioDeviceCallback(callback);
+ // remove twice
+ mAudioManager.unregisterAudioDeviceCallback(callback);
}
//TODO - Need tests for device connect/disconnect callbacks