Skip to content

Commit

Permalink
Pull request #719: MS-5381 Upgrade OMID version 1.4.8
Browse files Browse the repository at this point in the history
Merge in MOBILE-SDK/app_mobile-sdk-android from MS-5381_omid_upgrade_1.4.8 to develop

* commit 'e72001b5baed43f7a6e966b397b6bad8a93633f0':
  trackertestapp changes
  updated omid validation verification script
  fix unit test cases
  updated omid libs
  • Loading branch information
Ritesh Zaveri committed Oct 17, 2023
2 parents ac3f963 + e72001b commit 4ef5164
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 98 deletions.
3 changes: 1 addition & 2 deletions sdk/assets/OMLICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Open Measurement (OM) License, V 1.1

Open Measurement (OM) License for Native-App Measurement, V 1.1

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down
158 changes: 83 additions & 75 deletions sdk/assets/apn_omsdk.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions sdk/assets/mobilevastplayer.js

Large diffs are not rendered by default.

Binary file modified sdk/libs/omsdk.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions sdk/test/com/appnexus/opensdk/TestResponsesUT.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static void setTestURL(String url) {
private static final String MRAID_CONTENT = "<script type=\\\"text/javascript\\\" src=\\\"mraid.js\\\"></script><script type=\\\"text/javascript\\\">document.write('<div style=\\\"background-color:#EF8200;height:1000px;width:1000px;\\\"><p>%s</p></div>');</script>";
private static final String NATIVE_MAIN_MEDIA = "[{\"url\":\"%s\",\"width\":%d,\"height\":%d,\"label\":\"default\"},{\"url\":\"%s\",\"width\":%d,\"height\":%d},{\"url\":\"%s\",\"width\":%d,\"height\":%d}]";
private static final String NATIVE_RATING = "{\"value\":%.2f,\"scale\":%.2f}";
private static final String RTB_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendor;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_RENDERER_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendorRenderer;tv=cet=0;cecb=\\\"></script>";
private static final String CSM_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendorCSM;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendor;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_RENDERER_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendorRenderer;tv=cet=0;cecb=\\\"></script>";
private static final String CSM_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendorCSM;tv=cet=0;cecb=\\\"></script>";
// template strings
private static final String CLASSNAME = "com.appnexus.opensdk.testviews.%s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.appnexus.opensdk.shadows;

import android.webkit.ValueCallback;
import android.webkit.WebView;

import com.appnexus.opensdk.util.TestUtil;
Expand All @@ -33,11 +34,31 @@ public class ShadowOMIDBannerHTMLWebView extends ShadowWebView {
public static String omidImpressionString = "";
public static String omidStartSession = "";


/*
* OMID events call loadURL so its possible to store the values here and assert them against expected values.
* OMID events call evaluateJavascript so its possible to store the values here and assert them against expected values.
*/
@Override
protected void evaluateJavascript(String script, ValueCallback<String> callback) {
super.evaluateJavascript(script, callback);
webView = new WebView(RuntimeEnvironment.application);
Clog.d(TestUtil.testLogTag, "ShadowOMIDBannerHTMLWebView loadUrl::"+script);
if(script.contains("omidBridge.init")){
omidInitString = script;
}

if(script.contains("omidBridge.startSession")){
omidStartSession = script;
}

if(script.contains("publishImpressionEvent")){
omidImpressionString = script;
}
}

/*
* OMID events do not make a call to loadUrl as of version 1.4.3 and later.
*/
/*@Override
public void loadUrl(String url) {
super.loadUrl(url);
webView = new WebView(RuntimeEnvironment.application);
Expand All @@ -53,7 +74,7 @@ public void loadUrl(String url) {
if(url.contains("publishImpressionEvent")){
omidImpressionString = url;
}
}
}*/


/*
Expand Down
30 changes: 28 additions & 2 deletions sdk/test/com/appnexus/opensdk/shadows/ShadowOMIDNativeWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.appnexus.opensdk.shadows;

import android.webkit.ValueCallback;
import android.webkit.WebView;

import com.appnexus.opensdk.util.TestUtil;
Expand All @@ -35,9 +36,34 @@ public class ShadowOMIDNativeWebView extends ShadowWebView {
public static String omidFinishSession = "";

/*
* OMID events call loadURL so its possible to store the values here and assert them against expected values.
* OMID events call evaluateJavascript so its possible to store the values here and assert them against expected values.
*/
@Override
protected void evaluateJavascript(String script, ValueCallback<String> callback) {
super.evaluateJavascript(script, callback);
webView = new WebView(RuntimeEnvironment.application);
Clog.e(TestUtil.testLogTag, "ShadowOMIDNativeWebView loadUrl::"+script);
if(script.contains("omidBridge.init")){
omidInitString = script;
}

if(script.contains("omidBridge.startSession")){
omidStartSession = script;
}

if(script.contains("publishImpressionEvent")){
omidImpressionString = script;
}

if(script.contains(".finishSession()")){
omidFinishSession = script;
}
}

/*
* OMID events do not make a call to loadUrl as of version 1.4.3 and later.
*/
/*@Override
public void loadUrl(String url) {
super.loadUrl(url);
webView = new WebView(RuntimeEnvironment.application);
Expand All @@ -57,7 +83,7 @@ public void loadUrl(String url) {
if(url.contains(".finishSession()")){
omidFinishSession = url;
}
}
}*/


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ public void setup() {
private void assertVerificationScriptResourceRTB() {
ANOmidAdSession anOmidAdSession = getOMIDAdSession();
VerificationScriptResource verificationScriptResource = anOmidAdSession.verificationScriptResources.get(0);
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js"));
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js"));
assertTrue(verificationScriptResource.getVendorKey().equalsIgnoreCase("dummyVendor"));
assertTrue(verificationScriptResource.getVerificationParameters().equalsIgnoreCase("v;vk=dummyVendor;tv=cet=0;cecb="));
}

private void assertVerificationScriptResourceNativeRenderer() {
ANOmidAdSession anOmidAdSession = getOMIDAdSession();
VerificationScriptResource verificationScriptResource = anOmidAdSession.verificationScriptResources.get(0);
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js"));
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js"));
assertTrue(verificationScriptResource.getVendorKey().equalsIgnoreCase("dummyVendorRenderer"));
assertTrue(verificationScriptResource.getVerificationParameters().equalsIgnoreCase("v;vk=dummyVendorRenderer;tv=cet=0;cecb="));
}
Expand All @@ -95,7 +95,7 @@ private void assertVerificationScriptResourceNativeRenderer() {
private void assertVerificationScriptResourceCSM() {
ANOmidAdSession anOmidAdSession = getOMIDAdSession();
VerificationScriptResource verificationScriptResource = anOmidAdSession.verificationScriptResources.get(0);
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js"));
assertTrue(verificationScriptResource.getResourceUrl().toString().equalsIgnoreCase("https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js"));
assertTrue(verificationScriptResource.getVendorKey().equalsIgnoreCase("dummyVendorCSM"));
assertTrue(verificationScriptResource.getVerificationParameters().equalsIgnoreCase("v;vk=dummyVendorCSM;tv=cet=0;cecb="));
}
Expand Down

Large diffs are not rendered by default.

0 comments on commit 4ef5164

Please sign in to comment.