Skip to content

Commit 6a98ffb

Browse files
committed
Resolve VideoStreamManagerTests
1 parent e504c03 commit 6a98ffb

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
import com.smartdevicelink.proxy.rpc.ImageResolution;
2020
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
2121
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
22+
import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
23+
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
2224
import com.smartdevicelink.proxy.rpc.TouchCoord;
2325
import com.smartdevicelink.proxy.rpc.TouchEvent;
26+
import com.smartdevicelink.proxy.rpc.VehicleType;
2427
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
2528
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
2629
import com.smartdevicelink.proxy.rpc.enums.TouchType;
@@ -99,6 +102,12 @@ public void testInitialization(){
99102
ISdl internalInterface = mock(ISdl.class);
100103
when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,1,0));
101104

105+
RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
106+
VehicleType mockVehicleType = new VehicleType();
107+
mockVehicleType.setMake("Ford");
108+
mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
109+
when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
110+
102111
Answer<Void> onAddServiceListener = new Answer<Void>() {
103112
@Override
104113
public Void answer(InvocationOnMock invocation) {
@@ -126,6 +135,13 @@ public void testHMILevelNotFull(){
126135
final ISdl internalInterface = mock(ISdl.class);
127136

128137
when(internalInterface.getProtocolVersion()).thenReturn((new Version(5,0,0)));
138+
139+
RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
140+
VehicleType mockVehicleType = new VehicleType();
141+
mockVehicleType.setMake("Ford");
142+
mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
143+
when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
144+
129145
when(internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true);
130146

131147
final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
@@ -143,6 +159,12 @@ public void onComplete(boolean success) {
143159
public void testRemoteDisplayStream(){
144160
ISdl internalInterface = mock(ISdl.class);
145161

162+
RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
163+
VehicleType mockVehicleType = new VehicleType();
164+
mockVehicleType.setMake("Ford");
165+
mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
166+
when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
167+
146168
final Set<Object> listenerSet = new HashSet<>();
147169

148170
when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,0,0));
@@ -252,6 +274,13 @@ public void onComplete(boolean success) {
252274

253275
public void testConvertTouchEvent() {
254276
ISdl internalInterface = mock(ISdl.class);
277+
278+
RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
279+
VehicleType mockVehicleType = new VehicleType();
280+
mockVehicleType.setMake("Ford");
281+
mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
282+
when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
283+
255284
VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
256285
List<MotionEvent> motionEventList;
257286
long e1TS = 1558124390L, e2TS = 1558125390L, e3TS = 1558126390L;
@@ -467,6 +496,12 @@ public void testConvertTouchEvent_Scale_1_5() {
467496
private void assertMotionEventWithScale(int width, int height, float scale) {
468497
ISdl internalInterface = mock(ISdl.class);
469498

499+
RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
500+
VehicleType mockVehicleType = new VehicleType();
501+
mockVehicleType.setMake("Ford");
502+
mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
503+
when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
504+
470505
// Preferred Resolution capability
471506
ImageResolution resolution = new ImageResolution(width, height);
472507

0 commit comments

Comments
 (0)