Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
Update gradle files and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HaarigerHarald committed Mar 14, 2019
1 parent 0d0f7eb commit cb6f6e4
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 37 deletions.
3 changes: 1 addition & 2 deletions advancedDownloader/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28

defaultConfig {
applicationId "at.huber.youtubeDownloader"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 14 13:40:41 CET 2018
#Thu Mar 14 18:46:10 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-4.10.1-all.zip
3 changes: 1 addition & 2 deletions sampleApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28

defaultConfig {
applicationId "at.huber.sampleDownload"
Expand Down
11 changes: 7 additions & 4 deletions youtubeExtractor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
implementation('com.github.evgenyneu:js-evaluator-for-android:v4.0.0') {
exclude module: 'appcompat-v7'
}
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:support-annotations:28.0.0'

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
package at.huber.youtubeExtractor;

import android.os.Handler;
import android.os.Looper;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.FlakyTest;
import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.util.SparseArray;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import android.test.InstrumentationTestCase;
import android.util.Log;
import android.util.SparseArray;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNotSame;

public class ExtractorCase extends InstrumentationTestCase {
@RunWith(AndroidJUnit4.class)
@FlakyTest
public class ExtractorTestCases {

private static final String EXTRACTOR_TEST_TAG = "Extractor Test";

private String testUrl;

@Test
public void testUsualVideo() throws Throwable {
VideoMeta expMeta = new VideoMeta("YE7VzlLtp-4", "Big Buck Bunny", "Blender",
"UCSMOQeBJ2RAnuFungnQOxLg", 597, 0, false);
extractorTest("http:https://youtube.com/watch?v=YE7VzlLtp-4", expMeta);
extractorTestDashManifest("http:https://youtube.com/watch?v=YE7VzlLtp-4");
}

@Test
public void testUnembeddable() throws Throwable {
VideoMeta expMeta = new VideoMeta("QH4VHl2uQ9o", "Match Chain Reaction Amazing Fire Art", "BLACKHAND",
"UCl9nsRuGenStMDZfD95w85A", 331, 0, false);
extractorTest("https://www.youtube.com/watch?v=QH4VHl2uQ9o", expMeta);
extractorTestDashManifest("https://www.youtube.com/watch?v=QH4VHl2uQ9o");
}

@Test
public void testEncipheredVideo() throws Throwable {
VideoMeta expMeta = new VideoMeta("e8X3ACToii0", "Rise Against - Savior", "RiseAgainstVEVO",
VideoMeta expMeta = new VideoMeta("e8X3ACToii0", "Rise Against - Savior (Official Video)", "RiseAgainstVEVO",
"UChMKB2AHNpeuWhalpRYhUaw", 243, 0, false);
extractorTest("https://www.youtube.com/watch?v=e8X3ACToii0", expMeta);
}

@Test
public void testAgeRestrictVideo() throws Throwable {
VideoMeta expMeta = new VideoMeta("61Ev-YvBw2c", "Test video for age-restriction",
"jpdemoA", "UC95NqtFsDZKlmzOJmZi_g6Q", 14, 0, false);
Expand All @@ -57,12 +75,11 @@ private void extractorTestDashManifest(final String youtubeLink)

testUrl = null;

runTestOnUiThread(new Runnable() {
new Handler(Looper.getMainLooper()).post(new Runnable() {

@Override
public void run() {
final YouTubeExtractor ytEx = new YouTubeExtractor(getInstrumentation()
.getTargetContext()) {
final YouTubeExtractor ytEx = new YouTubeExtractor(InstrumentationRegistry.getContext()) {
@Override
public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta videoMeta) {
assertNotNull(ytFiles);
Expand Down Expand Up @@ -106,7 +123,7 @@ private void extractorTest(final String youtubeLink, final VideoMeta expMeta)

testUrl = null;

runTestOnUiThread(new Runnable() {
new Handler(Looper.getMainLooper()).post(new Runnable() {

@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package at.huber.youtubeExtractor;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ExtractorTestCases.class})
public class ExtractorTestSuite {}



0 comments on commit cb6f6e4

Please sign in to comment.