diff options
author | nchalko <nchalko@google.com> | 2018-02-20 12:06:44 -0800 |
---|---|---|
committer | Nick Chalko <nchalko@google.com> | 2018-02-21 11:12:34 -0800 |
commit | 45cafba282fd7826c8441c7a5d208582efd80158 (patch) | |
tree | 2e8cb7e986f3c1f43e3cc51c9bf5ea9a602c4854 | |
parent | 3027ec72dffade35972b9affb949a2e14b237f00 (diff) | |
download | TV-45cafba282fd7826c8441c7a5d208582efd80158.tar.gz |
CLEANUP: Move VerySlowSampleChunk to a shared testing package
PiperOrigin-RevId: 186341141
Change-Id: I85304d064910b32b293a7c2dc3b610e3f0f109ac
-rw-r--r-- | tests/tunerunit/src/com/android/tv/tuner/exoplayer/tests/SampleSourceExtractorTest.java | 2 | ||||
-rw-r--r-- | tuner/src/com/android/tv/tuner/exoplayer/buffer/SampleChunk.java | 6 | ||||
-rw-r--r-- | tuner/tests/testing/Android.mk | 29 | ||||
-rw-r--r-- | tuner/tests/testing/AndroidManifest.xml | 23 | ||||
-rw-r--r-- | tuner/tests/testing/src/com/android/tv/tuner/testing/buffer/VerySlowSampleChunk.java (renamed from tests/tunerunit/src/com/android/tv/tuner/exoplayer/buffer/VerySlowSampleChunk.java) | 6 |
5 files changed, 62 insertions, 4 deletions
diff --git a/tests/tunerunit/src/com/android/tv/tuner/exoplayer/tests/SampleSourceExtractorTest.java b/tests/tunerunit/src/com/android/tv/tuner/exoplayer/tests/SampleSourceExtractorTest.java index d2247c7d..4b75a107 100644 --- a/tests/tunerunit/src/com/android/tv/tuner/exoplayer/tests/SampleSourceExtractorTest.java +++ b/tests/tunerunit/src/com/android/tv/tuner/exoplayer/tests/SampleSourceExtractorTest.java @@ -26,7 +26,7 @@ import com.android.tv.tuner.exoplayer.ExoPlayerSampleExtractor; import com.android.tv.tuner.exoplayer.buffer.BufferManager; import com.android.tv.tuner.exoplayer.buffer.BufferManager.StorageManager; import com.android.tv.tuner.exoplayer.buffer.SampleChunk; -import com.android.tv.tuner.exoplayer.buffer.VerySlowSampleChunk; +import com.android.tv.tuner.testing.buffer.VerySlowSampleChunk; import com.android.tv.tuner.tvinput.PlaybackBufferListener; import com.google.android.exoplayer.MediaFormat; import com.google.android.exoplayer.SampleHolder; diff --git a/tuner/src/com/android/tv/tuner/exoplayer/buffer/SampleChunk.java b/tuner/src/com/android/tv/tuner/exoplayer/buffer/SampleChunk.java index 294912e1..bf77a6eb 100644 --- a/tuner/src/com/android/tv/tuner/exoplayer/buffer/SampleChunk.java +++ b/tuner/src/com/android/tv/tuner/exoplayer/buffer/SampleChunk.java @@ -79,7 +79,8 @@ public class SampleChunk { * @param startPositionUs the start position of the earliest sample to be stored * @param chunkCallback for total storage usage change notification */ - SampleChunk createSampleChunk( + @VisibleForTesting + public SampleChunk createSampleChunk( SamplePool samplePool, File file, long startPositionUs, @@ -121,7 +122,8 @@ public class SampleChunk { * Handles I/O for SampleChunk. Maintains current SampleChunk and the current offset for next * I/O operation. */ - static class IoState { + @VisibleForTesting + public static class IoState { private SampleChunk mChunk; private long mCurrentOffset; diff --git a/tuner/tests/testing/Android.mk b/tuner/tests/testing/Android.mk new file mode 100644 index 00000000..0d71b739 --- /dev/null +++ b/tuner/tests/testing/Android.mk @@ -0,0 +1,29 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +# Include all test java files. +LOCAL_SRC_FILES := \ + $(call all-java-files-under, src) \ + $(call all-Iaidl-files-under, src) + +LOCAL_STATIC_JAVA_LIBRARIES := \ + android-support-annotations \ + android-support-test \ + guava \ + mockito-target \ + platform-robolectric-3.6.1-prebuilt \ + truth-0-36-prebuilt-jar \ + ub-uiautomator \ + +# Link tv-common as shared library to avoid the problem of initialization of the constants +LOCAL_JAVA_LIBRARIES := tv-common + +LOCAL_INSTRUMENTATION_FOR := LiveTv +LOCAL_MODULE := tv-tuner-testing +LOCAL_MODULE_TAGS := optional +LOCAL_SDK_VERSION := system_current + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res +LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/src + +include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/tuner/tests/testing/AndroidManifest.xml b/tuner/tests/testing/AndroidManifest.xml new file mode 100644 index 00000000..f244ae7b --- /dev/null +++ b/tuner/tests/testing/AndroidManifest.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 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. + --> +<!-- Stub AndroidManifest.xml to build resources --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.tv.tuner.testing" + android:versionCode="1"> + <uses-sdk android:targetSdkVersion="26" android:minSdkVersion="21"/> + <application /> +</manifest> diff --git a/tests/tunerunit/src/com/android/tv/tuner/exoplayer/buffer/VerySlowSampleChunk.java b/tuner/tests/testing/src/com/android/tv/tuner/testing/buffer/VerySlowSampleChunk.java index ecfbb643..b68431cc 100644 --- a/tests/tunerunit/src/com/android/tv/tuner/exoplayer/buffer/VerySlowSampleChunk.java +++ b/tuner/tests/testing/src/com/android/tv/tuner/testing/buffer/VerySlowSampleChunk.java @@ -13,15 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.tv.tuner.exoplayer.buffer; +package com.android.tv.tuner.testing.buffer; import android.os.SystemClock; +import com.android.tv.tuner.exoplayer.buffer.SampleChunk; +import com.android.tv.tuner.exoplayer.buffer.SamplePool; import com.google.android.exoplayer.SampleHolder; import java.io.File; import java.io.IOException; +/** A Sample chunk that is slow for testing */ public class VerySlowSampleChunk extends SampleChunk { + /** Creates a {@link VerySlowSampleChunk}. */ public static class VerySlowSampleChunkCreator extends SampleChunkCreator { @Override public SampleChunk createSampleChunk( |