diff --git a/BUILD.gn b/BUILD.gn index 25a2fb4148..8eab81713e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -576,6 +576,7 @@ if (rtc_include_tests) { "examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java", "examples/androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java", "sdk/android/tests/src/org/webrtc/CameraEnumerationTest.java", + "sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java", ] deps = [ diff --git a/sdk/android/api/org/webrtc/VideoEncoder.java b/sdk/android/api/org/webrtc/VideoEncoder.java index af656bb4b3..3001120801 100644 --- a/sdk/android/api/org/webrtc/VideoEncoder.java +++ b/sdk/android/api/org/webrtc/VideoEncoder.java @@ -148,6 +148,11 @@ public interface VideoEncoder { this.low = low; this.high = high; } + + @Override + public String toString() { + return on ? "[ " + low + ", " + high + " ]" : "OFF"; + } } public interface Callback { diff --git a/sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java b/sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java new file mode 100644 index 0000000000..a092a7c485 --- /dev/null +++ b/sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java @@ -0,0 +1,29 @@ +/* + * Copyright 2018 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +package org.webrtc; + +import static org.junit.Assert.assertEquals; + +import org.chromium.testing.local.LocalRobolectricTestRunner; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.annotation.Config; +import org.webrtc.VideoEncoder.ScalingSettings; + +@RunWith(LocalRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class ScalingSettingsTest { + @Test + public void testToString() { + assertEquals("[ 1, 2 ]", new ScalingSettings(1, 2).toString()); + assertEquals("OFF", ScalingSettings.OFF.toString()); + } +}