mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add test that DefaultDataSource is able to build an RtmpDataSource
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=222387374
This commit is contained in:
parent
269615e62f
commit
233ff0729d
3 changed files with 64 additions and 0 deletions
|
|
@ -33,6 +33,8 @@ dependencies {
|
||||||
implementation project(modulePrefix + 'library-core')
|
implementation project(modulePrefix + 'library-core')
|
||||||
implementation 'net.butterflytv.utils:rtmp-client:3.0.1'
|
implementation 'net.butterflytv.utils:rtmp-client:3.0.1'
|
||||||
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
|
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
|
||||||
|
testImplementation 'junit:junit:' + junitVersion
|
||||||
|
testImplementation 'org.robolectric:robolectric:' + robolectricVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
|
|
||||||
17
extensions/rtmp/src/test/AndroidManifest.xml
Normal file
17
extensions/rtmp/src/test/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest package="com.google.android.exoplayer2.ext.rtmp"/>
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 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.google.android.exoplayer2.ext.rtmp;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultDataSource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
/** Unit test for {@link DefaultDataSource} with RTMP URIs. */
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public final class DefaultDataSourceTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void openRtmpDataSpec_instantiatesRtmpDataSourceViaReflection() throws IOException {
|
||||||
|
DefaultDataSource dataSource =
|
||||||
|
new DefaultDataSource(
|
||||||
|
RuntimeEnvironment.application, "userAgent", /* allowCrossProtocolRedirects= */ false);
|
||||||
|
DataSpec dataSpec = new DataSpec(Uri.parse("rtmp://test.com/stream"));
|
||||||
|
try {
|
||||||
|
dataSource.open(dataSpec);
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
// RtmpDataSource was successfully instantiated (test run using Gradle).
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// RtmpDataSource was successfully instantiated (test run using Blaze).
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue