示例#1
0
        public void DiscoverUnpublishConnectFails()
        {
            using (RemoteControllerLogGroup lg = new RemoteControllerLogGroup(remoteWFDController))
            {
                // Publish/Discover
                string serviceName = remoteWFDController.GenerateUniqueServiceName();
                ServicesPublishDiscoverParameters discoverParams = new ServicesPublishDiscoverParameters(
                    serviceName
                    );

                var publishDiscoverResults = ExecutePublishDiscoverScenario(discoverParams);

                // Verify results before we start using them
                Verify.AreEqual(1, publishDiscoverResults.PublishResults.Count);
                Verify.AreEqual(1, publishDiscoverResults.DiscoveryResults.Count);
                Verify.AreEqual(1, publishDiscoverResults.DiscoveryResults[0].DiscoveryHandles.Count);

                // Unpublish
                ServicesUnpublishParameters unpublishParams = new ServicesUnpublishParameters(
                    publishDiscoverResults.PublishResults[0].AdvertiserHandle,
                    false
                    );
                ExecuteUnpublishScenario(unpublishParams);

                // Connect (fail)
                ServicesConnectParameters connectParams = new ServicesConnectParameters(
                    publishDiscoverResults.DiscoveryResults[0].DiscoveryHandles[0],
                    publishDiscoverResults.PublishResults[0].AdvertiserHandle,
                    new ServicesConnectOptions(expectConnectSuccess: false)
                    );
                ExecuteConnectScenario(connectParams);
            }
        }
示例#2
0
 public ServicesPublishDiscoverScenario(
     WiFiDirectTestController discoveryTestController,
     WiFiDirectTestController advertiserTestController,
     ServicesPublishDiscoverParameters publishDiscoveryParameters
     )
 {
     this.discoveryTestController    = discoveryTestController;
     this.advertiserTestController   = advertiserTestController;
     this.publishDiscoveryParameters = publishDiscoveryParameters;
 }
示例#3
0
        ServicesPublishDiscoverScenarioResult ExecutePublishDiscoverScenario(ServicesPublishDiscoverParameters pubDiscoParams)
        {
            ServicesPublishDiscoverScenario scenario = new ServicesPublishDiscoverScenario(
                localWFDController,
                remoteWFDController,
                pubDiscoParams
                );
            ServicesPublishDiscoverScenarioResult scenarioResult = scenario.Execute();

            Verify.IsTrue(scenarioResult.ScenarioSucceeded);

            return(scenarioResult);
        }
示例#4
0
        public void SimpleDiscovery()
        {
            using (RemoteControllerLogGroup lg = new RemoteControllerLogGroup(remoteWFDController))
            {
                // Publish one service on remote and discover same from local
                string serviceName           = remoteWFDController.GenerateUniqueServiceName();
                var    publishDiscoverParams = new ServicesPublishDiscoverParameters(
                    serviceName,
                    discoveryType: ServicesDiscoveryType.FindAllAsync
                    );

                ExecutePublishDiscoverScenario(publishDiscoverParams);
            }
        }
示例#5
0
        public void SimpleServiceInfoNoMatchDiscovery()
        {
            using (RemoteControllerLogGroup lg = new RemoteControllerLogGroup(remoteWFDController))
            {
                // Publish one service on remote and discover same from local
                string serviceName           = remoteWFDController.GenerateUniqueServiceName();
                var    publishDiscoverParams = new ServicesPublishDiscoverParameters(
                    serviceName,
                    discoveryType: ServicesDiscoveryType.FindAllAsync,
                    serviceInfo: "<foo>bar</foo>",
                    serviceInfoRequest: "baz",
                    doesServiceInfoMatch: false
                    );

                ExecutePublishDiscoverScenario(publishDiscoverParams);
            }
        }
 /// <summary>
 /// Simple version for a single publish/discovery/connect of same service
 /// </summary>
 public ServicesPublishDiscoverConnectParameters(
     string serviceName,
     ServicesConnectOptions connectOptions,
     bool autoAccept = true,
     bool preferGO   = true,
     ServicePublishConfigMethods configMethods = ServicePublishConfigMethods.PinOrDefaultDisplay,
     ServicesDiscoveryType discoveryType       = ServicesDiscoveryType.Watcher,
     string deferredSessionInfo = ""
     )
 {
     PublishDiscoverParameters = new ServicesPublishDiscoverParameters(
         new List <ServicesPublishParameters> {
         new ServicesPublishParameters(serviceName, autoAccept, preferGO, configMethods, sessionInfo: deferredSessionInfo)
     },
         new List <ServicesDiscoveryPrePublishParameters> {
         new ServicesDiscoveryPrePublishParameters(serviceName, 1, new List <int> {
             0
         }, discoveryType)
     }
         );
     ConnectParameters = new List <ServicesConnectPreDiscoveryParameters> {
         new ServicesConnectPreDiscoveryParameters(0, 0, 0, connectOptions)
     };
 }