Exemplo n.º 1
0
 public ServicesSendDataScenario(
     WiFiDirectTestController senderWFDController,
     WiFiDirectTestController receiverWFDController,
     ServicesSendDataParameters dataParameters
     )
 {
     this.senderWFDController   = senderWFDController;
     this.receiverWFDController = receiverWFDController;
     this.dataParameters        = dataParameters;
 }
Exemplo n.º 2
0
        ServicesSendDataScenarioResult ExecuteSendDataScenario(ServicesSendDataParameters dataParams)
        {
            ServicesSendDataScenario scenario = new ServicesSendDataScenario(
                localWFDController,
                remoteWFDController,
                dataParams
                );
            ServicesSendDataScenarioResult scenarioResult = scenario.Execute();

            Verify.IsTrue(scenarioResult.ScenarioSucceeded);

            return(scenarioResult);
        }
Exemplo n.º 3
0
        public void SimpleAutoAcceptMultipleSimultaneousSessions()
        {
            using (RemoteControllerLogGroup lg = new RemoteControllerLogGroup(remoteWFDController))
            {
                string serviceName1 = remoteWFDController.GenerateUniqueServiceName();
                string serviceName2 = remoteWFDController.GenerateUniqueServiceName();
                string serviceName3 = remoteWFDController.GenerateUniqueServiceName();

                ServicesConnectOptions connectOptions = new ServicesConnectOptions(validateData: true);

                // NOTE: this will do FindAllAsync while all other tests use the watcher/incremental updates
                // Publish 2 services, discover/connect to first
                ServicesPublishDiscoverConnectParameters pdcParams = new ServicesPublishDiscoverConnectParameters(
                    serviceName1,
                    connectOptions
                    );
                var pdcResults = ExecutePublishDiscoverConnectScenario(pdcParams);

                Verify.AreEqual(1, pdcResults.PublishResults.Count);
                Verify.AreEqual(1, pdcResults.ConnectResults.Count);

                // Discover/connect to second
                ServicesPublishDiscoverConnectParameters pdc2Params = new ServicesPublishDiscoverConnectParameters(
                    serviceName2,
                    connectOptions,
                    discoveryType: ServicesDiscoveryType.Watcher
                    );
                var pdc2Results = ExecutePublishDiscoverConnectScenario(pdc2Params);

                Verify.AreEqual(1, pdc2Results.PublishResults.Count);
                Verify.AreEqual(1, pdc2Results.ConnectResults.Count);

                // Publish/discover/connect third service
                ServicesPublishDiscoverConnectParameters pdc3Params = new ServicesPublishDiscoverConnectParameters(
                    serviceName3,
                    connectOptions
                    );
                var pdc3Results = ExecutePublishDiscoverConnectScenario(pdc3Params);

                Verify.AreEqual(1, pdc3Results.PublishResults.Count);
                Verify.AreEqual(1, pdc3Results.ConnectResults.Count);

                // Disconnect second service
                ExecuteDisconnectScenario(
                    new ServicesDisconnectParameters(
                        pdc2Results.ConnectResults[0].SeekerSessionHandle,
                        pdc2Results.ConnectResults[0].AdvertiserSessionHandle
                        )
                    );

                // Try to send some more data on 1st session, expect still connected
                ServicesSendDataParameters sendDataParams = new ServicesSendDataParameters(
                    pdcResults.ConnectResults[0].SeekerSessionHandle,
                    pdcResults.ConnectResults[0].SeekerSocketHandle,
                    pdcResults.ConnectResults[0].AdvertiserSessionHandle,
                    pdcResults.ConnectResults[0].AdvertiserSocketHandle,
                    65536
                    );
                var sendDataResult = ExecuteSendDataScenario(sendDataParams);

                // Disconnect first/third service
                ExecuteDisconnectScenario(
                    new ServicesDisconnectParameters(
                        pdcResults.ConnectResults[0].AdvertiserSessionHandle,
                        pdcResults.ConnectResults[0].SeekerSessionHandle
                        ),
                    false
                    );
                ExecuteDisconnectScenario(
                    new ServicesDisconnectParameters(
                        pdc3Results.ConnectResults[0].SeekerSessionHandle,
                        pdc3Results.ConnectResults[0].AdvertiserSessionHandle
                        )
                    );
            }
        }