Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/0296 possibility to update video streaming capabilities #1434

Merged
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
5d30ae0
[poc/unknown-enums]
Apr 30, 2020
0958db7
[poc/unknown-enums]
Apr 30, 2020
67cc2e4
[poc/video-streaming]
Apr 30, 2020
4f48cd9
[poc/video-streaming]
Apr 30, 2020
dc7ca23
[poc/video-streaming]
Apr 30, 2020
e15cc65
[poc/video-streaming]
May 5, 2020
4e79b97
[poc/video-streaming]
May 19, 2020
ac26007
[poc/video-streaming]
May 27, 2020
f1a11c2
Merge branch 'develop' into poc/video_streaming_with_capabilities_update
May 27, 2020
e1d401d
[poc/video-streaming]
May 31, 2020
36a69c7
[poc/video-streaming]
Jun 8, 2020
c6744a3
[poc/video-streaming]
Jun 8, 2020
dbd4861
[poc/video-streaming]
Jun 8, 2020
b1a1748
[poc/video-streaming]
Jun 11, 2020
6d3ed1c
[poc/video-streaming]
Jun 12, 2020
483c0d8
[0296]
Jun 30, 2020
631938c
[VideoStreaming]
Jul 10, 2020
b856cef
[VideoStreaming]
Jul 15, 2020
9a82921
Merge branch 'develop' into poc/fork/video_streaming_with_capabilitie…
Jul 21, 2020
43434a8
[VideoStreaming]
Jul 21, 2020
ad5ef1a
[VideoStreaming]
Jul 27, 2020
7843cf3
[VideoStreaming]
Jul 28, 2020
ca86259
[VideoStreaming]
Jul 29, 2020
315cb85
[VideoStreaming]
Jul 30, 2020
770b69f
[VideoStreaming]
Aug 3, 2020
a6c1159
[VideoStreaming]
Aug 5, 2020
8d9e233
[VideoStreaming]
Aug 5, 2020
7e50ea7
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Aug 6, 2020
2c14221
[VideoStreaming]
Aug 6, 2020
be4e36d
Merge branch 'develop' into Feature/0296_possibility_to_update_video_…
Aug 18, 2020
d57ad9b
[0296]
Aug 18, 2020
dece45c
Merge remote-tracking branch 'origin/feature/0296_possibility_to_upda…
Aug 18, 2020
16e430a
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Aug 18, 2020
23b4799
Merge branch 'feature/0296_possibility_to_update_video_streaming_capa…
Aug 18, 2020
9b99237
Merge branch 'develop' into Feature/0296_possibility_to_update_video_…
Aug 18, 2020
e64d587
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
kboskin Aug 18, 2020
992ae76
[VideoStreaming]
Aug 19, 2020
036bb2c
Fix merge
Aug 19, 2020
a65b894
Merge branch 'feature/0296_possibility_to_update_video_streaming_capa…
Aug 19, 2020
7a95ce9
[VideoStreaming]
Aug 19, 2020
3aaf4bd
[VideoStreaming]
Aug 19, 2020
e2bf1b3
[VideoStreaming]
Aug 19, 2020
fe17e5a
[VideoStreaming]
Aug 19, 2020
1747be6
[VideoStreaming]
Aug 19, 2020
72d1e91
[VideoStreaming]
Aug 19, 2020
6f6ac80
[VideoStreaming]
Aug 19, 2020
cec21bb
[VideoStreaming]
Aug 19, 2020
530e9c0
[VideoStreaming]
Aug 19, 2020
4bc2fcd
[VideoStreaming]
Aug 19, 2020
f3f81e5
[VideoStreaming]
Aug 19, 2020
6994540
[VideoStreaming]
Aug 19, 2020
e281461
Merge remote-tracking branch 'origin/feature/0296_possibility_to_upda…
Aug 20, 2020
79e44f2
[0296]
Aug 20, 2020
332f8e6
[VideoStreaming]
Aug 20, 2020
e100f13
[VideoStreaming]
Aug 20, 2020
0e5b627
[VideoStreaming]
Aug 20, 2020
66cc5e9
[VideoStreaming]
Aug 20, 2020
81bc8ee
[VideoStreaming]
Aug 20, 2020
2df898e
[VideoStreaming]
Aug 21, 2020
09efe46
[VideoStreaming]
Aug 21, 2020
bdc46d2
[VideoStreaming]
Aug 26, 2020
be30579
[VideoStreaming]
Aug 26, 2020
c6c9a18
[VideoStreaming]
Aug 26, 2020
eb085c0
[VideoStreaming]
Aug 26, 2020
baf7898
[VideoStreaming]
Aug 27, 2020
5a066b8
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Aug 27, 2020
4c09868
[VideoStreaming]
Aug 27, 2020
9386074
[VideoStreaming]
Aug 27, 2020
710cff0
[VideoStreaming]
Aug 27, 2020
1e33dee
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Sep 10, 2020
622a516
[VideoStreaming]
Sep 10, 2020
02b3f68
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Sep 10, 2020
2005b83
[VideoStreaming]
Sep 10, 2020
8b8dc5a
[VideoStreaming]
Sep 21, 2020
af31063
[VideoStreaming]
Sep 25, 2020
94e1d8a
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Sep 28, 2020
2d25e4d
[VideoStreaming]
Sep 28, 2020
307aac6
[VideoStreaming]
Sep 29, 2020
6ef3090
[VideoStreaming]
Oct 11, 2020
06c5818
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Nov 11, 2020
5303319
[0296]
Nov 13, 2020
c5e6c26
[0296]
Nov 13, 2020
ac3c9a3
[0296]
Nov 13, 2020
891f8a8
[0296]
Nov 13, 2020
6c587df
[0296]
Nov 13, 2020
c8bdb20
[0296]
Nov 13, 2020
9da111a
[0296]
Nov 13, 2020
2395b68
[0296]
Nov 16, 2020
e268662
[0296]
Nov 16, 2020
3263ce1
[0296]
Nov 18, 2020
b4f78f5
[0297]
Dec 13, 2020
b567009
[0296]
Jan 6, 2021
c4baa70
[0296]
Jan 11, 2021
5f5da45
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Jan 28, 2021
a4757db
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Feb 2, 2021
11dda53
[0293]
Feb 2, 2021
859057a
[0296]
Feb 9, 2021
529cd74
[0296]
Feb 9, 2021
ad4e19b
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Feb 10, 2021
331ea3d
[0296]
Feb 10, 2021
aaba8bb
[0296]
Feb 10, 2021
1cbe9e7
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Feb 10, 2021
3c831a3
[0296]
Feb 10, 2021
3c10fd7
[0296]
Feb 10, 2021
87fe074
[0296]
Feb 10, 2021
f0350d0
[0296]
Feb 10, 2021
5ae9087
[0296]
Feb 11, 2021
6a96a47
[0296]
Feb 11, 2021
7511035
[0296]
Feb 11, 2021
39e217c
Update android/sdl_android/src/main/java/com/smartdevicelink/managers…
kboskin Feb 11, 2021
9b90850
Update android/sdl_android/src/main/java/com/smartdevicelink/managers…
kboskin Feb 11, 2021
717e68f
[0296]
Feb 11, 2021
8be00fa
Merge branch 'feature/0296_possibility_to_update_video_streaming_capa…
Feb 11, 2021
8cb97c8
[0296]
Feb 12, 2021
27affe5
[0296]
Feb 12, 2021
07cad3e
[0296]
Feb 15, 2021
e5930f1
[0296]
Feb 16, 2021
c53b422
[0238]
Feb 17, 2021
d85f468
[0238]
Feb 18, 2021
39882ae
[0238]
Feb 18, 2021
e7d6506
[0238]
Feb 18, 2021
81fa63c
[0296]
Feb 23, 2021
a9a0239
[0296]
Feb 25, 2021
175f897
[0296]
Feb 25, 2021
682c156
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Feb 25, 2021
0fbbf30
[0296]
Feb 25, 2021
18dd57c
[0296]
Feb 27, 2021
adf067b
[0296]
Mar 3, 2021
62fd852
[0296]
Mar 4, 2021
1c6ee23
[0296]
Mar 5, 2021
c790274
[0296]
Mar 8, 2021
56f6cc7
Merge branch 'develop' into feature/0296_possibility_to_update_video_…
Mar 8, 2021
038c990
[0293]
Mar 8, 2021
577df30
[0296]
Mar 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void setUp() throws Exception {
videoStreamingCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
videoStreamingCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
videoStreamingCapability.setPreferredFPS(TestValues.GENERAL_INTEGER);
videoStreamingCapability.setAdditionalVideoStreamingCapabilities(TestValues.GENERAL_ADDITIONAL_CAPABILITY_LIST);
systemCapability.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
}

Expand Down Expand Up @@ -214,6 +215,7 @@ public void testGetVSCapability() {
VideoStreamingCapability vsCapability = new VideoStreamingCapability();
vsCapability.setMaxBitrate(TestValues.GENERAL_INT);
vsCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
vsCapability.setAdditionalVideoStreamingCapabilities(TestValues.GENERAL_ADDITIONAL_CAPABILITY_LIST);
vsCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
vsCapability.setPreferredFPS(TestValues.GENERAL_INTEGER);

Expand Down Expand Up @@ -325,7 +327,7 @@ public void testGetCapability() {
scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));


Expand All @@ -338,7 +340,7 @@ public void testGetCapability() {
scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));


// Test case 4 (capability cached, listener null, forceUpdate false)
Expand Down Expand Up @@ -384,7 +386,7 @@ public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabi
OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));


Expand Down Expand Up @@ -412,7 +414,7 @@ public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabi
// When the last listener is removed, GetSystemCapability request should go out with subscribe=false
doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
}

@Test
Expand Down Expand Up @@ -506,7 +508,7 @@ public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCap
// When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
}

@Test
Expand Down Expand Up @@ -553,7 +555,7 @@ public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCap
// When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
}

@Test
Expand All @@ -578,8 +580,8 @@ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsA

// Get Capability (should notify listener1 again)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(2)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));


// Add listener2
Expand All @@ -590,9 +592,9 @@ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsA

// Get Capability (should notify listener1 & listener2 again)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(3)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(2)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));


// Add listener3
Expand All @@ -603,10 +605,10 @@ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsA

// Get Capability (should notify listener1 & listener2 & listener3 again)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(3)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(3)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(2)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));


// Remove listener1
Expand All @@ -615,10 +617,10 @@ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsA

// Get Capability (should notify listener2 & listener3 again)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(4)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(3)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));


// Remove listener2
Expand All @@ -627,23 +629,23 @@ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsA

// Get Capability (should notify listener3 again)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));


// Remove listener3
scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));


// Get Capability (should not notify any listener again because they are all removed)
scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
verify(internalInterface, times(6)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
}

@Test
Expand Down Expand Up @@ -961,7 +963,7 @@ public void removeServiceListener(SessionType serviceType, ISdlServiceListener s
}

@Override
public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
public void startVideoService(VideoStreamingParameters parameters, boolean encrypted, boolean withPendingRestart) {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -70,6 +71,7 @@ public class VideoStreamManagerTests {
public static final String TAG = "VideoStreamManagerTests";
private Context mTestContext;
private static boolean touchEventOccured = false;
private static boolean viewResizedCalled = false;

// SETUP / HELPERS

Expand All @@ -93,6 +95,11 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(simulatedView);
}

@Override
public void onViewResized(int width, int height) {
viewResizedCalled = true;
}

@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
touchEventOccured = true;
Expand All @@ -106,6 +113,7 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
public void testInitialization() {
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getProtocolVersion()).thenReturn(new Version(5, 1, 0));
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
VehicleType mockVehicleType = new VehicleType();
Expand Down Expand Up @@ -160,14 +168,15 @@ public void onComplete(boolean success) {
VideoStreamingParameters params = new VideoStreamingParameters();
boolean encrypted = false;
videoStreamManager.startStreaming(params, encrypted);
verify(internalInterface, times(0)).startVideoService(params, encrypted);
verify(internalInterface, times(0)).startVideoService(params, encrypted, false);
}
});
}

@Test
public void testRemoteDisplayStream() {
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
VehicleType mockVehicleType = new VehicleType();
Expand Down Expand Up @@ -268,19 +277,65 @@ public void onComplete(boolean success) {
hmiListener[0].onNotified(fullNotification);

videoStreamManager.startRemoteDisplayStream(mTestContext, TestPresentation.class, null, false);

//assertTrue(touchEventOccured);

assertTrue(touchEventOccured);
videoStreamManager.dispose();
assertTrue(listenerSet.isEmpty());
}
});

}

@Test
public void testOnViewResized() {
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

final OnRPCNotificationListener[] hmiListener = {null};

Answer<Void> onAddHMIListener = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
hmiListener[0] = (OnRPCNotificationListener) args[1];
return null;
}
};

doAnswer(onAddHMIListener).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));

final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
videoStreamManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
assertTrue(success);
OnHMIStatus fullNotification = new OnHMIStatus();
fullNotification.setHmiLevel(HMILevel.HMI_FULL);
hmiListener[0].onNotified(fullNotification);

videoStreamManager.startRemoteDisplayStream(mTestContext, TestPresentation.class, null, false);

Field sdlRemoteDisplayField = null;
try {
sdlRemoteDisplayField =
VideoStreamManager.class.getDeclaredField("sdlRemoteDisplay");
} catch (NoSuchFieldException e) { e.printStackTrace(); }
sdlRemoteDisplayField.setAccessible(true);

SdlRemoteDisplay display = null;
try {
display = (SdlRemoteDisplay) sdlRemoteDisplayField.get(videoStreamManager);
} catch (IllegalAccessException e) { e.printStackTrace(); }
display.onViewResized(100, 100);

assertTrue(viewResizedCalled);
}
});
}

@Test
public void testConvertTouchEvent() {
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
VehicleType mockVehicleType = new VehicleType();
Expand Down Expand Up @@ -495,6 +550,7 @@ public void testConvertTouchEvent_Scale_1_5() {

private void assertMotionEventWithScale(int width, int height, float scale) {
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
VehicleType mockVehicleType = new VehicleType();
Expand Down Expand Up @@ -528,13 +584,16 @@ private void assertMotionEventWithScale(int width, int height, float scale) {

motionEvent = motionEventList.get(0);
assertEquals(1, motionEvent.getPointerCount());
assertEquals(Math.round(e1x / scale), Math.round(motionEvent.getX(0)));
assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
assertEquals(Math.round(e1x * scale), Math.round(motionEvent.getX(0)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In VideoStreamManager.java there is this line pointer.setCoords(touchCoord.getX() / touchScalar[0], touchCoord.getY() / touchScalar[1]); where the MotionEvent pointer is set using division. How come in the unit test it has been changed to multiplication?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In VideoStreamManager.java there is this line pointer.setCoords(touchCoord.getX() / touchScalar[0], touchCoord.getY() / touchScalar[1]); where the MotionEvent pointer is set using division. How come in the unit test it has been changed to multiplication?

@KostyaBoss In VideoStreamManager.java there is this line pointer.setCoords(touchCoord.getX() / touchScalar[0], touchCoord.getY() / touchScalar[1]); where the MotionEvent pointer is set using division. How come in the unit test it has been changed to multiplication?

assertEquals(Math.round(e1y * scale), Math.round(motionEvent.getY(0)));
}

@Test
public void testIsHMIStateVideoStreamCapable() {
VideoStreamManager videoStreamManager = new VideoStreamManager(mock(ISdl.class));
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getSystemCapabilityManager()).thenReturn(mock(SystemCapabilityManager.class));

VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);

// Case 1 (VideoStreamingState = STREAMABLE)
assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, VideoStreamingState.STREAMABLE)));
Expand Down
Loading