Skip to content

Commit

Permalink
Release 3.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-crowe committed Jul 13, 2021
1 parent 618ce50 commit 73eee20
Show file tree
Hide file tree
Showing 122 changed files with 4,156 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ captures
testServerAddress.txt
app/bin
unity-ads/bin
libs
javadoc
.settings
.project
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ test-local-staging-localhost: device-connected wake-up-device push-test-server-a
run-all-tests: test-instrumentation test-legacy test-integration

test-ci:
./gradlew connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.InstrumentationTestSuite,com.unity3d.ads.test.LegacyTestSuite
./gradlew unity-ads:connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.InstrumentationTestSuite,com.unity3d.ads.test.LegacyTestSuite

test-instrumentation:
./gradlew connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.InstrumentationTestSuite
./gradlew unity-ads:connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.InstrumentationTestSuite

test-legacy:
./gradlew connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.LegacyTestSuite
./gradlew unity-ads:connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.LegacyTestSuite

test-integration:
./gradlew connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.IntegrationTestSuite
./gradlew unity-ads:connectedDebugAndroidTest -i -w --stacktrace -Pandroid.testInstrumentationRunnerArguments.class=com.unity3d.ads.test.IntegrationTestSuite

push-test-server-address-ip:
echo http://$(shell ifconfig |grep "inet" |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |grep -v -E "^0|^127" -m 1):8080 > testServerAddress.txt
Expand Down
17 changes: 6 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.unity3d.ads.example"
minSdkVersion 19
targetSdkVersion 30
versionCode = 3720
versionName = "3.7.2"
versionCode = 3740
versionName = "3.7.4"
}

flavorDimensions "arEnabled"
Expand All @@ -27,18 +27,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation "com.google.android.material:material:1.3.0"
implementation "androidx.appcompat:appcompat:1.3.0"
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
arImplementation 'com.google.ar:core:1.4.0'
implementation 'androidx.transition:transition:1.4.1'
implementation project(':unity-ads')
}
Binary file modified app/src/main/res/drawable/unityads_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

buildscript {
repositories {
jcenter()
gradlePluginPortal()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'org.jacoco:org.jacoco.core:0.8.1'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.20.0'
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
}
}

apply from: 'nexusPublishing.gradle'
apply from: 'nexusPublishing.gradle'
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include ':app', ':unity-ads'
include ':unity-scaradapter-1920'
include ':unity-scaradapter-1950'
include ':unity-scaradapter-2000'
include ':unity-scaradapter-common'
include ':app', ':unity-ads'
26 changes: 23 additions & 3 deletions unity-ads/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ dependencies {
ext {
GROUP_ID = "com.unity3d.ads"
ARTIFACT_ID = "unity-ads"
VERSION_ID = "3.7.2"
VERSION_CODE = 3720
VERSION_ID = "3.7.4"
VERSION_CODE = 3740
SIGN_AAR = properties.getProperty("SIGN_AAR") ?: false
}

Expand All @@ -47,6 +47,7 @@ android {
buildConfigField('int', 'VERSION_CODE', "$versionCode")
buildConfigField('String', 'VERSION_NAME', "\"$versionName\"")
testBuildType "debug"
multiDexEnabled true

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
testInstrumentationRunnerArguments disableAnalytics: 'true' // Won't work yet, see: https://code.google.com/p/android/issues/detail?id=188241
Expand All @@ -71,6 +72,25 @@ android {
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation project(':unity-scaradapter-2000')
androidTestImplementation project(':unity-scaradapter-1950')
androidTestImplementation project(':unity-scaradapter-1920')
androidTestImplementation project(':unity-scaradapter-common')
androidTestImplementation 'org.mockito:mockito-core:2.28.2'
androidTestImplementation 'org.mockito:mockito-android:2.25.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'com.google.android.gms:play-services-ads:19.5.0'
compileOnly 'com.google.ar:core:1.0.0'
compileOnly project(':unity-scaradapter-2000')
compileOnly project(':unity-scaradapter-1950')
compileOnly project(':unity-scaradapter-1920')
compileOnly project(':unity-scaradapter-common')
}

task javadoc(type: Javadoc) {
description "Generates Javadoc for Release"
source = android.sourceSets.main.java.srcDirs
Expand Down Expand Up @@ -126,4 +146,4 @@ def getPropertyStringWithDefaultValue(String key, String defaultValue) {

apply from: 'publishing.gradle'
apply from: 'artifactory.gradle'
apply from: 'jacoco.gradle'
apply from: 'jacoco.gradle'
4 changes: 4 additions & 0 deletions unity-ads/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" />
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.unity3d.ads.test;

import com.unity3d.ads.test.instrumentation.services.ads.gmascar.GmaScarTestSuite;
import com.unity3d.ads.test.instrumentation.services.ads.operation.AdOperationTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleDecoratorInitializationBufferTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleDecoratorTests;
Expand Down Expand Up @@ -28,7 +29,6 @@
AcquisitionTypeTest.class,
AdsPropertiesTests.class,
InitializationNotificationCenterTest.class,
// LoadBridgeTest.class,
WebPlayerViewSettingsCacheTest.class,
WebPlayerViewCacheTest.class,
BannerViewCacheTests.class,
Expand All @@ -42,7 +42,8 @@
LoadModuleDecoratorInitializationBufferTests.class,
AdOperationTests.class,
ShowModuleTests.class,
ConfigurationTest.class
ConfigurationTest.class,
GmaScarTestSuite.class
})

public class InstrumentationTestSuite {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar;

import com.unity3d.ads.test.instrumentation.services.ads.gmascar.adapters.ScarAdapterFactoryTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.finder.GMAInitializerTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.finder.PresenceDetectorTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.finder.ScarVersionFinderTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges.AdapterStatusBridgeTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges.InitializationStatusBridgeTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges.InitializeListenerBridgeTest;
import com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges.MobileAdsBridgeTest;

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

@RunWith(Suite.class)
@Suite.SuiteClasses({
ScarAdapterFactoryTest.class,
GMAInitializerTest.class,
PresenceDetectorTest.class,
ScarVersionFinderTest.class,
AdapterStatusBridgeTest.class,
InitializationStatusBridgeTest.class,
InitializeListenerBridgeTest.class,
MobileAdsBridgeTest.class
})
public class GmaScarTestSuite {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar.adapters;

import com.unity3d.scar.adapter.common.IAdsErrorHandler;
import com.unity3d.scar.adapter.common.IScarAdapter;
import com.unity3d.services.ads.gmascar.adapters.ScarAdapterFactory;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class ScarAdapterFactoryTest {
@Mock
private IAdsErrorHandler adsErrorHandlerMock;

private ScarAdapterFactory _scarAdapterFactory = new ScarAdapterFactory();

@Test
public void testScarAdapterFactory1920() {
IScarAdapter adapter = _scarAdapterFactory.createScarAdapter(ScarAdapterFactory.CODE_19_2, adsErrorHandlerMock);
Assert.assertTrue(adapter instanceof com.unity3d.scar.adapter.v1920.ScarAdapter);
}

@Test
public void testScarAdapterFactory1950() {
IScarAdapter adapter = _scarAdapterFactory.createScarAdapter(ScarAdapterFactory.CODE_19_5, adsErrorHandlerMock);
Assert.assertTrue(adapter instanceof com.unity3d.scar.adapter.v1950.ScarAdapter);
}

@Test
public void testScarAdapterFactory2000() {
IScarAdapter adapter = _scarAdapterFactory.createScarAdapter(ScarAdapterFactory.CODE_20_0, adsErrorHandlerMock);
Assert.assertTrue(adapter instanceof com.unity3d.scar.adapter.v2000.ScarAdapter);
}

@Test
public void testScarAdapterFactoryUnsupported() {
IScarAdapter adapter = _scarAdapterFactory.createScarAdapter(-1, adsErrorHandlerMock);
Assert.assertNull(adapter);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges;

import com.google.android.gms.ads.initialization.AdapterStatus;
import com.unity3d.services.ads.gmascar.bridges.AdapterStatusBridge;

import org.junit.Assert;
import org.junit.Test;

public class AdapterStatusBridgeTest {

@Test
public void testAdapterStatusBridge() {
AdapterStatusBridge adapterStatusBridge = new AdapterStatusBridge();
Object[] statesEnum = adapterStatusBridge.getAdapterStatesEnum();
Assert.assertEquals(AdapterStatus.State.values().length, statesEnum.length);
Assert.assertEquals(AdapterStatus.State.NOT_READY, statesEnum[0]);
Assert.assertEquals(AdapterStatus.State.READY, statesEnum[1]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges;

import com.unity3d.services.ads.gmascar.bridges.InitializationStatusBridge;

import org.junit.Assert;
import org.junit.Test;

import java.util.Map;

public class InitializationStatusBridgeTest {

@Test
public void testInitializationStatusBridgeNotInitialized() {
InitializationStatusBridge initializationStatusBridge = new InitializationStatusBridge();
Map<String, Object> adapterStatusMap = initializationStatusBridge.getAdapterStatusMap(new Object());
Assert.assertNull(adapterStatusMap);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges;

import com.unity3d.services.ads.gmascar.bridges.InitializeListenerBridge;

import org.junit.Assert;
import org.junit.Test;

public class InitializeListenerBridgeTest {

@Test
public void testInitializeListenerBridge() {
InitializeListenerBridge initializeListenerBridge = new InitializeListenerBridge();
Object listenerProxy = initializeListenerBridge.createInitializeListenerProxy();
Assert.assertNotNull(listenerProxy);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.unity3d.ads.test.instrumentation.services.ads.gmascar.bridges;

import androidx.test.platform.app.InstrumentationRegistry;

import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.unity3d.services.ads.gmascar.bridges.MobileAdsBridge;

import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;

import static org.mockito.Mockito.timeout;

public class MobileAdsBridgeTest {

@Test
@Ignore("Have to ignore for now cause the bridge is stateful (underlying call to GMA static init depends on other tests")
public void testMobileAdsBridgeGetVersionNotInitialized() {
MobileAdsBridge mobileAdsBridge = new MobileAdsBridge();
String versionString = mobileAdsBridge.getVersionString();
Assert.assertEquals("0.0.0", versionString);
}

@Test
public void testMobileAdsBridgeGetVersion() {
OnInitializationCompleteListener initializationCompleteListener = Mockito.mock(OnInitializationCompleteListener.class);
MobileAdsBridge mobileAdsBridge = new MobileAdsBridge();
mobileAdsBridge.initialize(InstrumentationRegistry.getInstrumentation().getContext(), initializationCompleteListener);
Mockito.verify(initializationCompleteListener, timeout(1000).times(1)).onInitializationComplete(Mockito.any(InitializationStatus.class));
String versionString = mobileAdsBridge.getVersionString();
Assert.assertTrue(String.format("Minor version 203404000 is not found in %s", versionString), versionString.contains("203404000"));
}

@Test
@Ignore("Cannot test this case since the underlying GMA call is static so test ordering impacts this result.")
public void testMobileAdsBridgeGetInitStatusNotInitialized() {
MobileAdsBridge mobileAdsBridge = new MobileAdsBridge();
Object initializationStatus = mobileAdsBridge.getInitializationStatus();
Assert.assertNull(initializationStatus);
}

@Test
public void testMobileAdsBridgeGetInitStatus() {
OnInitializationCompleteListener initializationCompleteListener = Mockito.mock(OnInitializationCompleteListener.class);
MobileAdsBridge mobileAdsBridge = new MobileAdsBridge();
mobileAdsBridge.initialize(InstrumentationRegistry.getInstrumentation().getContext(), initializationCompleteListener);
Object initializationStatus = mobileAdsBridge.getInitializationStatus();
Assert.assertTrue(InitializationStatus.class.isAssignableFrom(initializationStatus.getClass()));
}
}
Loading

0 comments on commit 73eee20

Please sign in to comment.