Exemplo n.º 1
0
        public void Rdpei_TouchControlTest_Positive_Suspend()
        {
            Site.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            Site.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEI ...");
            bool bProtocolSupported = this.rdpeiServer.CreateRdpeiDvc(waitTime);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            // RDPEI initializing phase
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SC_READY_PDU.");
            RDPINPUT_SC_READY_PDU scReadyPdu = this.rdpeiServer.CreateRdpInputScReadyPdu();

            this.rdpeiServer.SendRdpInputScReadyPdu(scReadyPdu);

            Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_CS_READY_PDU ...");
            RDPINPUT_CS_READY_PDU csReadyPdu = this.rdpeiServer.ExpectRdpInputCsReadyPdu(waitTime);

            TestSite.Assert.IsTrue(csReadyPdu != null, "Client is expected to send RDPINPUT_CS_READY_PDU to the server.");

            // RDPEI running phase
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SUSPEND_TOUCH_PDU.");
            RDPINPUT_SUSPEND_TOUCH_PDU suspendPdu = this.rdpeiServer.CreateRdpInputSuspendTouchPdu();

            this.rdpeiServer.SendRdpInputSuspendTouchPdu(suspendPdu);

            this.rdpeiSUTControlAdapter.TriggerContinuousTouchEventOnClient(this.TestContext.TestName);

            // Expect to reveice nothing after sending the RDPINPUT_SUSPEND_TOUCH_PDU message.
            RDPINPUT_PDU pdu = this.rdpeiServer.ExpectRdpInputPdu(waitTime);

            TestSite.Assert.IsNull(pdu, "Client must suspend the transmission of touch frames after receiving a RDPINPUT_SUSPEND_TOUCH_PDU message.");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method to create a RDPINPUT_SUSPEND_TOUCH_PDU.
        /// </summary>
        /// <returns>The created RDPINPUT_SUSPEND_TOUCH_PDU.</returns>
        public RDPINPUT_SUSPEND_TOUCH_PDU CreateRdpInputSuspendTouchPdu()
        {
            RDPINPUT_SUSPEND_TOUCH_PDU pdu = new RDPINPUT_SUSPEND_TOUCH_PDU();

            pdu.header.eventId   = EventId_Values.EVENTID_SUSPEND_TOUCH;
            pdu.header.pduLength = pdu.Length();
            return(pdu);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method to send a RDPINPUT_SUSPEND_TOUCH_PDU to client.
        /// </summary>
        /// <param name="pdu">A RDPINPUT_SUSPEND_TOUCH_PDU structure.</param>
        public void SendRdpInputSuspendTouchPdu(RDPINPUT_SUSPEND_TOUCH_PDU pdu)
        {
            byte[] data = PduMarshaler.Marshal(pdu);

            // Sleep some time to avoid this packet to be merged with other packets in TCP level.
            System.Threading.Thread.Sleep(PacketsInterval);
            if (rdpeiDVC == null)
            {
                throw new InvalidOperationException("DVC instance of RDPEI is null, Dynamic virtual channel must be created before sending data.");
            }
            rdpeiDVC.Send(data);
        }
Exemplo n.º 4
0
        public void Rdpei_TouchControlTest_Negative_DuplicatedResume()
        {
            Site.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            Site.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEI ...");
            bool bProtocolSupported = this.rdpeiServer.CreateRdpeiDvc(waitTime);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            // RDPEI initializing phase
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SC_READY_PDU.");
            RDPINPUT_SC_READY_PDU scReadyPdu = this.rdpeiServer.CreateRdpInputScReadyPdu();

            this.rdpeiServer.SendRdpInputScReadyPdu(scReadyPdu);

            Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_CS_READY_PDU ...");
            RDPINPUT_CS_READY_PDU csReadyPdu = this.rdpeiServer.ExpectRdpInputCsReadyPdu(waitTime);

            TestSite.Assert.IsTrue(csReadyPdu != null, "Client is expected to send RDPINPUT_CS_READY_PDU to the server.");

            // RDPEI running phase
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SUSPEND_TOUCH_PDU.");
            RDPINPUT_SUSPEND_TOUCH_PDU suspendPdu = this.rdpeiServer.CreateRdpInputSuspendTouchPdu();

            this.rdpeiServer.SendRdpInputSuspendTouchPdu(suspendPdu);

            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_RESUME_TOUCH_PDU.");
            RDPINPUT_RESUME_TOUCH_PDU resumePdu = this.rdpeiServer.CreateRdpInputResumeTouchPdu();

            this.rdpeiServer.SendRdpInputResumeTouchPdu(resumePdu);

            // Send a duplicated resume message to test the client will ignore it, since the Touch Remoting Suspended ADM element is already set to FALSE.
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_RESUME_TOUCH_PDU.");
            this.rdpeiServer.SendRdpInputResumeTouchPdu(resumePdu);

            this.rdpeiSUTControlAdapter.TriggerOneTouchEventOnClient(this.TestContext.TestName);

            Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_TOUCH_EVENT_PDU ...");
            RDPINPUT_TOUCH_EVENT_PDU touchEventPdu = this.rdpeiServer.ExpectRdpInputTouchEventPdu(waitTime);

            VerifyRdpInputTouchEventPdu(touchEventPdu, true);

            if (isManagedAdapter)
            {
                RdpeiUtility.SendConfirmImage();
            }
        }
Exemplo n.º 5
0
        public void Rdpei_TouchControlTest_Negative_InvalidResumePduLength()
        {
            Site.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            Site.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEI ...");
            bool bProtocolSupported = this.rdpeiServer.CreateRdpeiDvc(waitTime);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            // RDPEI initializing phase
            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SC_READY_PDU.");
            RDPINPUT_SC_READY_PDU scReadyPdu = this.rdpeiServer.CreateRdpInputScReadyPdu();

            this.rdpeiServer.SendRdpInputScReadyPdu(scReadyPdu);

            Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_CS_READY_PDU ...");
            RDPINPUT_CS_READY_PDU csReadyPdu = this.rdpeiServer.ExpectRdpInputCsReadyPdu(waitTime);

            TestSite.Assert.IsTrue(csReadyPdu != null, "Client is expected to send RDPINPUT_CS_READY_PDU to the server.");

            // RDPEI running phase

            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SUSPEND_TOUCH_PDU.");
            RDPINPUT_SUSPEND_TOUCH_PDU suspendPdu = this.rdpeiServer.CreateRdpInputSuspendTouchPdu();

            this.rdpeiServer.SendRdpInputSuspendTouchPdu(suspendPdu);

            Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_RESUME_TOUCH_PDU with invalid PduLength.");
            RDPINPUT_INVALID_PDU invalidPdu = CreateRdpInputInvalidPdu((ushort)EventId_Values.EVENTID_RESUME_TOUCH, 16, null);

            SendRdpInvalidPdu(invalidPdu);

            // Expect the client to ignore the RDPINPUT_RESUME_TOUCH_PDU with invalid pduLength.
            this.rdpeiSUTControlAdapter.TriggerContinuousTouchEventOnClient(this.TestContext.TestName);

            // Expect to reveice nothing.
            RDPINPUT_PDU pdu = this.rdpeiServer.ExpectRdpInputPdu(waitTime);

            TestSite.Assert.IsNull(pdu, "Client should ignore the RDPINPUT_RESUME_TOUCH_PDU message when the pduLength field is inconsistent with the amount of data read from DVC.");
        }
 /// <summary>
 /// The callback method to receive data from transport layer.
 /// </summary>
 private void OnDataReceived(byte[] data, uint channelID)
 {
     lock (receivedList)
     {
         RDPINPUT_PDU pdu     = new RDPINPUT_PDU();
         bool         fResult = PduMarshaler.Unmarshal(data, pdu);
         if (fResult)
         {
             byte[] pduData = new byte[pdu.header.pduLength];
             Array.Copy(data, pduData, pduData.Length);
             RDPINPUT_PDU msg = pdu;
             if (pdu.header.eventId == EventId_Values.EVENTID_SC_READY)
             {
                 RDPINPUT_SC_READY_PDU request = new RDPINPUT_SC_READY_PDU();
                 if (PduMarshaler.Unmarshal(pduData, request))
                 {
                     msg = request;
                 }
             }
             else if (pdu.header.eventId == EventId_Values.EVENTID_SUSPEND_TOUCH)
             {
                 RDPINPUT_SUSPEND_TOUCH_PDU request = new RDPINPUT_SUSPEND_TOUCH_PDU();
                 if (PduMarshaler.Unmarshal(pduData, request))
                 {
                     msg = request;
                 }
             }
             else if (pdu.header.eventId == EventId_Values.EVENTID_RESUME_TOUCH)
             {
                 RDPINPUT_RESUME_TOUCH_PDU request = new RDPINPUT_RESUME_TOUCH_PDU();
                 if (PduMarshaler.Unmarshal(pduData, request))
                 {
                     msg = request;
                 }
             }
             receivedList.Add(msg);
         }
     }
 }