Skip to content

Commit c09b56a

Browse files
Update RAI tests
1 parent d3acc3f commit c09b56a

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"carrier":"nobody",
3030
"maxNumberRFCOMMPorts":2
3131
},
32+
"appInfo":{
33+
"appDisplayName":"Test",
34+
"appBundleID":"com.sample.test",
35+
"appVersion":"1.0",
36+
"appIcon":"icon.png"
37+
},
3238
"appName":"Dumb app",
3339
"ngnMediaScreenAppName":"DA",
3440
"isMediaApplication":true,

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.smartdevicelink.protocol.enums.FunctionID;
1717
import com.smartdevicelink.proxy.SdlProxyBase;
1818
import com.smartdevicelink.proxy.TTSChunkFactory;
19+
import com.smartdevicelink.proxy.rpc.AppInfo;
1920
import com.smartdevicelink.proxy.rpc.AppServiceCapability;
2021
import com.smartdevicelink.proxy.rpc.AppServiceData;
2122
import com.smartdevicelink.proxy.rpc.AppServiceManifest;
@@ -262,6 +263,7 @@ public class Test {
262263
public static final VrHelpItem GENERAL_VRHELPITEM = new VrHelpItem();
263264
public static final ImageField GENERAL_IMAGEFIELD = new ImageField();
264265
public static final DeviceInfo GENERAL_DEVICEINFO = new DeviceInfo();
266+
public static final AppInfo GENERAL_APPINFO = new AppInfo();
265267
public static final LayoutMode GENERAL_LAYOUTMODE = LayoutMode.LIST_ONLY;
266268
public static final MenuParams GENERAL_MENUPARAMS = new MenuParams();
267269
public static final SoftButton GENERAL_SOFTBUTTON = new SoftButton();
@@ -535,6 +537,7 @@ public void onVoiceCommandSelected() {
535537
public static final JSONObject JSON_SOFTBUTTON = new JSONObject();
536538
public static final JSONObject JSON_MENUPARAMS = new JSONObject();
537539
public static final JSONObject JSON_DEVICEINFO = new JSONObject();
540+
public static final JSONObject JSON_APPINFO = new JSONObject();
538541
public static final JSONObject JSON_VRHELPITEM = new JSONObject();
539542
public static final JSONObject JSON_SCREENPARAMS = new JSONObject();
540543
public static final JSONObject JSON_SDLMSGVERSION = new JSONObject();

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,6 +2598,24 @@ public static boolean validateDeviceInfo (DeviceInfo item1, DeviceInfo item2) {
25982598
return true;
25992599
}
26002600

2601+
public static boolean validateAppInfo (AppInfo item1, AppInfo item2) {
2602+
if (item1 == null) {
2603+
return ( item2 == null );
2604+
}
2605+
if (item2 == null) {
2606+
return ( item1 == null );
2607+
}
2608+
2609+
if (item1.getAppDisplayName() != item1.getAppDisplayName()
2610+
|| item1.getAppBundleID() != item2.getAppBundleID()
2611+
|| item1.getAppVersion() != item2.getAppVersion()
2612+
|| item1.getAppIcon() != item2.getAppIcon()) {
2613+
return false;
2614+
}
2615+
2616+
return true;
2617+
}
2618+
26012619
public static boolean validateTemplateColorScheme (TemplateColorScheme item1, TemplateColorScheme item2) {
26022620
if (item1 == null) {
26032621
return ( item2 == null );

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.smartdevicelink.marshal.JsonRPCMarshaller;
44
import com.smartdevicelink.protocol.enums.FunctionID;
55
import com.smartdevicelink.proxy.RPCMessage;
6+
import com.smartdevicelink.proxy.rpc.AppInfo;
67
import com.smartdevicelink.proxy.rpc.DeviceInfo;
78
import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
89
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
@@ -46,6 +47,7 @@ protected RPCMessage createMessage() {
4647
msg.setAppHMIType(Test.GENERAL_APPHMITYPE_LIST);
4748
msg.setIsMediaApplication(Test.GENERAL_BOOLEAN);
4849
msg.setDeviceInfo(Test.GENERAL_DEVICEINFO);
50+
msg.setAppInfo(Test.GENERAL_APPINFO);
4951
msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
5052
msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
5153

@@ -80,6 +82,7 @@ protected JSONObject getExpectedParameters(int sdlVersion) {
8082
result.put(RegisterAppInterface.KEY_APP_HMI_TYPE, JsonUtils.createJsonArrayOfJsonNames(Test.GENERAL_APPHMITYPE_LIST, SDL_VERSION_UNDER_TEST));
8183
result.put(RegisterAppInterface.KEY_IS_MEDIA_APPLICATION, Test.GENERAL_BOOLEAN);
8284
result.put(RegisterAppInterface.KEY_DEVICE_INFO, Test.JSON_DEVICEINFO);
85+
result.put(RegisterAppInterface.KEY_APP_INFO, Test.JSON_APPINFO);
8386
result.put(RegisterAppInterface.KEY_DAY_COLOR_SCHEME, Test.JSON_DAYCOLORSCHEME);
8487
result.put(RegisterAppInterface.KEY_NIGHT_COLOR_SCHEME, Test.JSON_NIGHTCOLORSCHEME);
8588
} catch (JSONException e) {
@@ -107,6 +110,7 @@ public void testRpcValues () {
107110
List<AppHMIType> testApps = ( (RegisterAppInterface) msg).getAppHMIType();
108111
Boolean testMedia = ( (RegisterAppInterface) msg).getIsMediaApplication();
109112
DeviceInfo testDeviceInfo = ( (RegisterAppInterface) msg).getDeviceInfo();
113+
AppInfo testAppInfo = ( (RegisterAppInterface) msg).getAppInfo();
110114
TemplateColorScheme testDayColorScheme = ( (RegisterAppInterface) msg).getDayColorScheme();
111115
TemplateColorScheme testNightColorScheme = ( (RegisterAppInterface) msg).getNightColorScheme();
112116

@@ -124,6 +128,7 @@ public void testRpcValues () {
124128
assertEquals(Test.MATCH, Test.GENERAL_APPHMITYPE_LIST, testApps);
125129
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, testMedia);
126130
assertTrue(Test.TRUE, Validator.validateDeviceInfo(Test.GENERAL_DEVICEINFO, testDeviceInfo));
131+
assertTrue(Test.TRUE, Validator.validateAppInfo(Test.GENERAL_APPINFO, testAppInfo));
127132
assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
128133
assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
129134

@@ -145,6 +150,7 @@ public void testRpcValues () {
145150
assertNull(Test.NULL, msg.getAppHMIType());
146151
assertNull(Test.NULL, msg.getIsMediaApplication());
147152
assertNull(Test.NULL, msg.getDeviceInfo());
153+
assertNull(Test.NULL, msg.getAppInfo());
148154
assertNull(Test.NULL, msg.getDayColorScheme());
149155
assertNull(Test.NULL, msg.getNightColorScheme());
150156
}
@@ -193,6 +199,10 @@ public void testJsonConstructor () {
193199
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
194200
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());
195201

202+
JSONObject appInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_APP_INFO);
203+
AppInfo appInfo = new AppInfo(JsonRPCMarshaller.deserializeJSONObject(appInfoObj));
204+
assertTrue(Test.TRUE, Validator.validateAppInfo(appInfo, cmd.getAppInfo()));
205+
196206
List<String> vrSynonymsList = JsonUtils.readStringListFromJsonObject(parameters, RegisterAppInterface.KEY_VR_SYNONYMS);
197207
List<String> testSynonymsList = cmd.getVrSynonyms();
198208
assertEquals(Test.MATCH, vrSynonymsList.size(), testSynonymsList.size());

0 commit comments

Comments
 (0)