Skip to content

Commit 718bd2c

Browse files
author
Unity Ads Travis
committed
Release 2.3.0
1 parent 9855a65 commit 718bd2c

19 files changed

+748
-685
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.unity3d.ads.example"
99
minSdkVersion 9
1010
targetSdkVersion 23
11-
versionCode = 2201
12-
versionName = "2.2.1"
11+
versionCode = 2300
12+
versionName = "2.3.0"
1313
}
1414
buildTypes {
1515
release {

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<application
66
android:allowBackup="true"
77
android:icon="@mipmap/ic_launcher"
8-
android:label="UnityAds 2.2"
8+
android:label="UnityAds 2.3"
99
android:theme="@style/AppTheme" >
1010
<activity
1111
android:name="com.unity3d.ads.example.UnityAdsExample"
1212
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
13-
android:label="UnityAds 2.2" >
13+
android:label="UnityAds 2.3" >
1414
<intent-filter>
1515
<action android:name="android.intent.action.MAIN" />
1616
<category android:name="android.intent.category.LAUNCHER" />

lib/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
defaultConfig {
1212
minSdkVersion 9
1313
targetSdkVersion 23
14-
versionCode = 2201
15-
versionName = "2.2.1"
14+
versionCode = 2300
15+
versionName = "2.3.0"
1616

1717
setProperty("archivesBaseName", "unity-ads")
1818

lib/src/androidTest/java/com/unity3d/ads/test/UnitTestSuite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
StorageGeneralTest.class,
3131
StorageMemoryTest.class,
3232
VideoViewTest.class,
33-
WebRequestTest.class,
3433
WebViewAppTest.class,
3534
WebViewBridgeInterfaceTest.class,
3635
WebViewBridgeTest.class,
@@ -39,7 +38,8 @@
3938
VolumeChangeTest.class,
4039
UtilitiesTest.class,
4140
WebPlayerTest.class,
42-
PreferencesTest.class
41+
PreferencesTest.class,
42+
WebRequestThreadPoolTest.class
4343
})
4444

4545
public class UnitTestSuite {}

lib/src/androidTest/java/com/unity3d/ads/test/unit/DeviceTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ public void testGetProcessInfo () throws Exception {
227227

228228
assertNotNull("Stats should not be null", data.get("stat"));
229229
assertNotEquals("Stats should not be empty", data.get("stat"), "");
230-
231-
assertNotNull("Uptime should not be null", data.get("uptime"));
232-
assertNotEquals("Uptime should not be empty", data.get("uptime"), "");
233230
}
234231

235232
@Test

lib/src/androidTest/java/com/unity3d/ads/test/unit/RequestTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import com.unity3d.ads.api.Request;
99
import com.unity3d.ads.properties.ClientProperties;
10-
import com.unity3d.ads.request.WebRequest;
1110
import com.unity3d.ads.request.WebRequestError;
1211
import com.unity3d.ads.request.WebRequestEvent;
1312
import com.unity3d.ads.test.TestUtilities;

lib/src/androidTest/java/com/unity3d/ads/test/unit/UtilitiesTest.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,55 @@
11
package com.unity3d.ads.test.unit;
22

3+
import android.support.test.InstrumentationRegistry;
34
import android.util.Log;
45

56
import com.unity3d.ads.misc.Utilities;
7+
import com.unity3d.ads.properties.ClientProperties;
8+
import com.unity3d.ads.properties.SdkProperties;
69

710
import org.json.JSONObject;
11+
import org.junit.Before;
812
import org.junit.Test;
913

1014
import java.io.ByteArrayInputStream;
15+
import java.io.File;
16+
import java.io.FileOutputStream;
17+
import java.io.IOException;
1118

1219
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotEquals;
1321

1422
public class UtilitiesTest {
23+
@Before
24+
public void setup() throws IOException {
25+
ClientProperties.setApplicationContext(InstrumentationRegistry.getTargetContext());
26+
assertNotEquals("Cache directory has not been properly initialized", null, SdkProperties.getCacheDirectory());
27+
28+
File tesfile_large = new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_large.dat");
29+
tesfile_large.delete();
30+
31+
File tesfile_small = new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_small.dat");
32+
tesfile_small.delete();
33+
34+
// Write large test file to cache directory
35+
File largef = new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_large.dat");
36+
FileOutputStream lfos = new FileOutputStream(largef, true);
37+
for (int i = 0; i < 56789; i++) {
38+
lfos.write((int)(Math.random() * 128) + 1);
39+
}
40+
lfos.flush();
41+
lfos.close();
42+
43+
File smallf = new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_small.dat");
44+
FileOutputStream sfos = new FileOutputStream(smallf, true);
45+
for (int i = 0; i < 1024; i++) {
46+
sfos.write((int)(Math.random() * 128) + 1);
47+
}
48+
sfos.flush();
49+
sfos.close();
50+
}
51+
52+
1553
@Test
1654
public void testSha256() throws Exception {
1755
assertEquals("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", Utilities.Sha256(""));
@@ -74,6 +112,15 @@ public void testSha256Stream() throws Exception {
74112
assertHash(0, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
75113
}
76114

115+
@Test
116+
public void testReadFileBytes() throws Exception {
117+
byte[] large_data = Utilities.readFileBytes(new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_large.dat"));
118+
byte[] small_data = Utilities.readFileBytes(new File(SdkProperties.getCacheDirectory() + "/" + SdkProperties.getCacheFilePrefix() + "testfile_small.dat"));
119+
120+
assertEquals("Incorrect read large file data size", 56789, large_data.length);
121+
assertEquals("Incorrect read small file data size", 1024, small_data.length);
122+
}
123+
77124
public void assertHash(int size, String sha256) throws Exception {
78125
byte[] buffer = new byte[size];
79126

lib/src/androidTest/java/com/unity3d/ads/test/unit/VideoViewTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public void run() {
222222

223223
assertTrue("Condition Variable was not opened: VIDEOPLAYER GENERIC ERROR or PREPARE ERROR was not received", success);
224224
assertEquals("Event category should be videoplayer category", WebViewEventCategory.VIDEOPLAYER, mockWebViewApp.EVENT_CATEGORIES.get(0));
225-
assertEquals("Event ID should be generic error", VideoPlayerEvent.GENERIC_ERROR, mockWebViewApp.EVENTS.get(0));
225+
assertTrue("Events should contain GENERIC_ERROR", mockWebViewApp.EVENTS.contains(VideoPlayerEvent.GENERIC_ERROR));
226226
assertEquals("The video url and the url received from the completed event should be the same", invalidUrl, mockWebViewApp.EVENT_PARAMS[0]);
227227
assertTrue("Didn't get activity finish", waitForActivityFinish(activity));
228228
}
@@ -808,4 +808,4 @@ public void run() {
808808
DeviceLog.debug("Skipping test \"testInfoListenerTooLowApiLevel\", API level too high: " + Build.VERSION.SDK_INT);
809809
}
810810
}
811-
}
811+
}

lib/src/androidTest/java/com/unity3d/ads/test/unit/VolumeChangeTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public void testVolumeChange() throws Exception {
3838

3939
ClientProperties.setApplicationContext(getInstrumentation().getTargetContext());
4040

41+
AudioManager am = (AudioManager)ClientProperties.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
42+
am.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
43+
4144
WebViewApp.setCurrentApp(new MockWebViewApp() {
4245
private boolean allowEvents = true;
4346
@Override
@@ -114,7 +117,6 @@ public int getStreamType() {
114117

115118
VolumeChange.registerListener(vcl);
116119

117-
AudioManager am = (AudioManager)ClientProperties.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
118120
am.setStreamVolume(AudioManager.STREAM_MUSIC, 1, 0);
119121

120122
cv = new ConditionVariable();

0 commit comments

Comments
 (0)