-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #367 in MOBILE-SDK/app_mobile-sdk-android from ANA…
…dResponseInfo_Implementation to develop Squashed commit of the following: commit 90524f530ac20305abfc087b393633528909228d Author: Abhas Vohra <[email protected]> Date: Sat Feb 29 01:18:45 2020 +0530 Handled NO BID case for VideoAd commit ce17bbe7090ce9417d5d0b77852c2314aca3272c Author: Abhas Vohra <[email protected]> Date: Sat Feb 29 01:17:53 2020 +0530 Handled NO BID case commit f11f486598888388007a06f37d43323e7f9afd74 Author: Abhas Vohra <[email protected]> Date: Sat Feb 29 01:03:14 2020 +0530 Removed AdResponseInfo APIs from BaseAdDispatcher and consequent uses commit 13636e5250b5682185ddb7e665f79f94d9b440e8 Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 21:58:25 2020 +0530 Updated Sample Apps commit d58805f9ea279db889dd06b8a5a14fedac52da39 Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 20:56:14 2020 +0530 Moved the common implementation to the BaseNativeAdResponse commit 099318021b00a572fdd65f05485a1f46ecaf53f1 Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 20:45:41 2020 +0530 Overridden AdResponseInfo methods in the BaseNativeAdResponse commit a071eb84cd32a9502cc1f64477abd899f5c6e1ea Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 20:17:39 2020 +0530 Fixed Unit Tests commit 4ee0d449de4918c54e6beb7a4e5ba2e8a5d38d9c Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 19:24:19 2020 +0530 Fixed broken CSR Unit Tests commit 3fdae39579e05fbfd8627f8a849b27c7034836f5 Merge: f1d92a2 7f7c349 Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 14:16:04 2020 +0530 Merge with develop commit f1d92a29c682af12af3ddae5fade972dfaa5e950 Author: Abhas Vohra <[email protected]> Date: Fri Feb 28 14:09:26 2020 +0530 Removed ANAdResponseInfo form AdListener's and VideoAdListener's onAdRequestFailed, set the AdResponse to the AdUnit (except Native) commit afca02e0320be2f2a13cc730d95c64db3ad8a8ed Merge: 19bb156 1e51ae1 Author: Abhas Vohra <[email protected]> Date: Thu Feb 27 15:27:08 2020 +0530 Merge: latest develop commit 19bb156ff444cbf87847a8904bda9f003f1711b1 Author: Abhas Vohra <[email protected]> Date: Thu Feb 27 00:08:26 2020 +0530 PR comments commit 8a9b7084d1ac0de656d21e36b7256fba46d1c3d9 Author: Abhas Vohra <[email protected]> Date: Mon Feb 24 20:56:27 2020 +0530 BannerAdView returns null for Banner Native AdResponseInfo, fixed Unit tests, Added Unit tests commit ee6823011f172932c9e967639cf2dfd197c65c19 Author: Abhas Vohra <[email protected]> Date: Thu Feb 20 20:44:24 2020 +0530 Refined Unit Test commit 2e5043d3f378aecf47b5f399b8d4031ef722b977 Author: Abhas Vohra <[email protected]> Date: Thu Feb 20 18:09:51 2020 +0530 Changed the Native Ad implementation as per iOS commit d2d05469fbf2adb0a15d2e0b5eca7cba9d6ff46a Author: Abhas Vohra <[email protected]> Date: Thu Feb 20 03:18:04 2020 +0530 Updated as per the comments commit 820bb8796c75e8d6bb0fc734e6686dc96a634f09 Author: Abhas Vohra <[email protected]> Date: Wed Feb 19 22:27:43 2020 +0530 Added public facing APIs for getting the Member Id and Publisher Id commit 132698450bbef7a0958291288a13efa21dc3c4d4 Author: Abhas Vohra <[email protected]> Date: Wed Feb 19 21:29:27 2020 +0530 Code Refactor commit 7eef54b6b5068cdc6619cccfb5ce2d9a837e977f Merge: bd33061 eaacc30 Author: Abhas Vohra <[email protected]> Date: Wed Feb 19 21:18:56 2020 +0530 Merged Publisher ID changes commit eaacc30798d06213396cc10df85683641784da63 Author: Abhas Vohra <[email protected]> Date: Wed Feb 19 19:55:00 2020 +0530 Added Publisher ID to the UTRequest Parameters, Added Unit Tests ... and 5 more commits
- Loading branch information
Kowshickkarthick Subramanian
committed
Feb 28, 2020
1 parent
7f7c349
commit 1c62f24
Showing
66 changed files
with
1,264 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...eamvideo/src/test/java/com/appnexus/opensdk/instreamvideo/ANAdResponseInfoVideoTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright 2018 APPNEXUS INC | ||
* | ||
* 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.appnexus.opensdk.instreamvideo; | ||
|
||
import com.appnexus.opensdk.ANAdResponseInfo; | ||
import com.appnexus.opensdk.AdType; | ||
import com.appnexus.opensdk.ResultCode; | ||
import com.appnexus.opensdk.instreamvideo.shadows.ShadowAsyncTaskNoExecutor; | ||
import com.appnexus.opensdk.instreamvideo.shadows.ShadowCustomWebView; | ||
import com.appnexus.opensdk.instreamvideo.shadows.ShadowSettings; | ||
import com.appnexus.opensdk.instreamvideo.shadows.ShadowWebSettings; | ||
import com.appnexus.opensdk.ut.UTConstants; | ||
import com.squareup.okhttp.mockwebserver.MockResponse; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.Robolectric; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
import org.robolectric.shadows.ShadowLog; | ||
|
||
import static junit.framework.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertNull; | ||
|
||
@Config(sdk = 21, | ||
shadows = {ShadowAsyncTaskNoExecutor.class, | ||
ShadowCustomWebView.class, ShadowWebSettings.class, ShadowSettings.class, ShadowLog.class}) | ||
@RunWith(RobolectricTestRunner.class) | ||
public class ANAdResponseInfoVideoTests extends BaseRoboTest implements VideoAdLoadListener { | ||
|
||
VideoAd videoAd; | ||
ANAdResponseInfo adResponseInfo; | ||
|
||
@Override | ||
public void setup() { | ||
super.setup(); | ||
videoAd = new VideoAd(activity,"12345"); | ||
videoAd.setAdLoadListener(this); | ||
} | ||
|
||
@Override | ||
public void tearDown() { | ||
super.tearDown(); | ||
videoAd = null; | ||
adResponseInfo = null; | ||
} | ||
|
||
@Test | ||
public void testAdResponseInfoRTBVideo() { | ||
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response | ||
assertNull(videoAd.getAdResponseInfo()); | ||
executeVideoRequest(); | ||
assertNotNull(videoAd.getAdResponseInfo()); | ||
assertEquals(videoAd.getAdResponseInfo().getAdType(), AdType.VIDEO); | ||
assertEquals(videoAd.getAdResponseInfo().getCreativeId(), "6332753"); | ||
assertEquals(videoAd.getAdResponseInfo().getTagId(), "123456"); | ||
assertEquals(videoAd.getAdResponseInfo().getBuyMemberId(), 123); | ||
assertEquals(videoAd.getAdResponseInfo().getContentSource(), UTConstants.RTB); | ||
assertEquals(videoAd.getAdResponseInfo().getNetworkName(), ""); | ||
} | ||
|
||
@Test | ||
public void testAdResponseInfoRTBVideoNoBid() { | ||
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.NO_BID)); | ||
assertNull(videoAd.getAdResponseInfo()); | ||
executeVideoRequest(); | ||
assertNotNull(videoAd.getAdResponseInfo()); | ||
assertEquals(videoAd.getAdResponseInfo().getAdType(), null); | ||
assertEquals(videoAd.getAdResponseInfo().getCreativeId(), ""); | ||
assertEquals(videoAd.getAdResponseInfo().getTagId(), "123456789"); | ||
assertEquals(videoAd.getAdResponseInfo().getBuyMemberId(), 0); | ||
assertEquals(videoAd.getAdResponseInfo().getContentSource(), ""); | ||
assertEquals(videoAd.getAdResponseInfo().getNetworkName(), ""); | ||
} | ||
|
||
@Test | ||
public void testAdResponseInfoRTBVideoBlank() { | ||
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.blank())); | ||
assertNull(videoAd.getAdResponseInfo()); | ||
executeVideoRequest(); | ||
assertNull(videoAd.getAdResponseInfo()); | ||
} | ||
|
||
private void executeVideoRequest() { | ||
videoAd.loadAd(); | ||
|
||
waitForTasks(); | ||
Robolectric.flushBackgroundThreadScheduler(); | ||
Robolectric.flushForegroundThreadScheduler(); | ||
|
||
waitForTasks(); | ||
Robolectric.flushBackgroundThreadScheduler(); | ||
Robolectric.flushForegroundThreadScheduler(); | ||
} | ||
|
||
@Override | ||
public void onAdLoaded(VideoAd videoAd) { | ||
|
||
} | ||
|
||
@Override | ||
public void onAdRequestFailed(VideoAd videoAd, ResultCode errorCode) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.