Skip to content

Commit

Permalink
v0.9.4.1 Beta Release - re-add CSRF handling, formatting fixes (#241)
Browse files Browse the repository at this point in the history
* Update content for WER
* Update docs for XML.

* Update Copyright to 2017 :)
  • Loading branch information
hpsin authored May 5, 2017
1 parent 904195d commit e69aa95
Show file tree
Hide file tree
Showing 32 changed files with 324 additions and 215 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For documentation on the WDP REST endpoints which the project wraps, see the fol

### HoloLens specific methods

[HoloLens Device Portal API reference](https://developer.microsoft.com/en-us/windows/holographic/device_portal_api_reference)
[HoloLens Device Portal API reference](https://developer.microsoft.com/en-us/windows/mixed-reality/device_portal_api_reference)

---

Expand Down
7 changes: 5 additions & 2 deletions Samples/XboxWdpDriver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,11 @@ public static void Main(string[] args)
break;

case OperationType.InstallOperation:
// Ensure we have an IP since SMB might need it for path generation.
parameters.AddParameter(ParameterHelper.IpOrHostname, targetConsole);
if (!parameters.HasParameter(ParameterHelper.IpOrHostname))
{
// Ensure we have an IP since SMB might need it for path generation.
parameters.AddParameter(ParameterHelper.IpOrHostname, targetConsole);
}

InstallOperation.HandleOperation(portal, parameters);
break;
Expand Down
5 changes: 4 additions & 1 deletion WindowsDevicePortalWrapper/UnitTestProject/Core/EtwTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public void GetEtwProvidersTest()
ValidateEtwProviders(getEtwProvidersTask.Result);
}

/// <summary>
/// Basic test of Get methof for getting ETW events.
/// </summary>
[TestMethod]
public void GetEtwEventsTest()
{
Expand All @@ -61,7 +64,7 @@ public void GetEtwEventsTest()
EtwEvents etwEvents = null;

WindowsDevicePortal.WebSocketMessageReceivedEventHandler<EtwEvents> etwEventsReceivedHandler =
delegate (DevicePortal sender, WebSocketMessageReceivedEventArgs<EtwEvents> args)
delegate(DevicePortal sender, WebSocketMessageReceivedEventArgs<EtwEvents> args)
{
if (args.Message != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// </copyright>
//----------------------------------------------------------------------------------------------

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Microsoft.Tools.WindowsDevicePortal.DevicePortal;

namespace Microsoft.Tools.WindowsDevicePortal.Tests
Expand Down Expand Up @@ -307,7 +307,6 @@ public void GetUpdateInstallTime_IoT()

// Check some known things about this response.
Assert.AreEqual(0, installTime.RebootScheduled);

}

/// <summary>
Expand Down Expand Up @@ -396,21 +395,20 @@ public void SetDeviceNameTest_IoT()
Assert.AreEqual(TaskStatus.RanToCompletion, setIoTDeviceName.Status);
}


/// <summary>
/// Simple test to set SoftAp Settings
/// </summary>
[TestMethod]
public void SetSoftApSettingsTest_IoT()
{
string SoftApEnabled = "true";
string SoftApSsid = "SoftAPSsid";
string SoftApPassword = "p@ssw0rd";
string softApEnabled = "true";
string softApSsid = "SoftAPSsid";
string softApPassword = "p@ssw0rd";

HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.SoftAPSettingsApi, response, HttpMethods.Post);

Task setSoftApSettings = TestHelpers.Portal.SetSoftApSettingsAsync(SoftApEnabled, SoftApSsid, SoftApPassword);
Task setSoftApSettings = TestHelpers.Portal.SetSoftApSettingsAsync(softApEnabled, softApSsid, softApPassword);
setSoftApSettings.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, setSoftApSettings.Status);
Expand Down Expand Up @@ -495,7 +493,7 @@ public void SetControllersDriversTest_IoT()
setIoTControllersDrivers.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, setIoTControllersDrivers.Status);
Assert.AreEqual(requestReboot, setIoTControllersDrivers.Result.RequestReboot );
Assert.AreEqual(requestReboot, setIoTControllersDrivers.Result.RequestReboot);
}

/// <summary>
Expand Down Expand Up @@ -694,10 +692,10 @@ public void SetRenderVolumeTest_IoT()
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.SetRenderVolumeApi, response, HttpMethods.Post);

Task RenderVolume = TestHelpers.Portal.SetRenderVolumeAsync(renderVolume);
RenderVolume.Wait();
Task renderVolumeTask = TestHelpers.Portal.SetRenderVolumeAsync(renderVolume);
renderVolumeTask.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, RenderVolume.Status);
Assert.AreEqual(TaskStatus.RanToCompletion, renderVolumeTask.Status);
}

/// <summary>
Expand All @@ -711,10 +709,10 @@ public void SetCaptureVolumeTest_IoT()
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.SetCaptureVolumeApi, response, HttpMethods.Post);

Task CaptureVolume = TestHelpers.Portal.SetCaptureVolumeAsync(captureVolume);
CaptureVolume.Wait();
Task captureVolumeTask = TestHelpers.Portal.SetCaptureVolumeAsync(captureVolume);
captureVolumeTask.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, CaptureVolume.Status);
Assert.AreEqual(TaskStatus.RanToCompletion, captureVolumeTask.Status);
}

/// <summary>
Expand All @@ -729,10 +727,10 @@ public void IcSharingStartTest_IoT()
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.IcSharingApi, response, HttpMethods.Post);

Task IcsStart = TestHelpers.Portal.IcSharingStartAsync(privateInterfaceIndex, publicInterfaceIndex);
IcsStart.Wait();
Task icsStart = TestHelpers.Portal.IcSharingStartAsync(privateInterfaceIndex, publicInterfaceIndex);
icsStart.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, IcsStart.Status);
Assert.AreEqual(TaskStatus.RanToCompletion, icsStart.Status);
}

/// <summary>
Expand All @@ -747,10 +745,10 @@ public void IcSharingStopTest_IoT()
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(DevicePortal.IcSharingApi, response, HttpMethods.Delete);

Task IcsStop = TestHelpers.Portal.IcSharingStopAsync(privateInterfaceIndex, publicInterfaceIndex);
IcsStop.Wait();
Task icsStop = TestHelpers.Portal.IcSharingStopAsync(privateInterfaceIndex, publicInterfaceIndex);
icsStop.Wait();

Assert.AreEqual(TaskStatus.RanToCompletion, IcsStop.Status);
Assert.AreEqual(TaskStatus.RanToCompletion, icsStop.Status);
}

/// <summary>
Expand Down Expand Up @@ -966,8 +964,8 @@ public void SetTpmAcpiTablesTest_IoT()
public void SetTpmLogicalDeviceSettingsTest_IoT()
{
int logicalDeviceId = 1;
string azureUri = "";
string azureKey = "";
string azureUri = string.Empty;
string azureKey = string.Empty;

HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
TestHelpers.MockHttpResponder.AddMockResponse(string.Format("{0}/{1}", DevicePortal.TpmSettingsApi, logicalDeviceId), response, HttpMethods.Post);
Expand Down Expand Up @@ -1005,7 +1003,7 @@ public void GetTpmAzureTokenInfo_IoT()
string validity = "18000";

TestHelpers.MockHttpResponder.AddMockResponse(
string.Format("{0}/{1}", TpmAzureTokenApi, logicalDeviceId),
string.Format("{0}/{1}", DevicePortal.TpmAzureTokenApi, logicalDeviceId),
this.PlatformType,
this.FriendlyOperatingSystemVersion,
HttpMethods.Get);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private async Task ConnectInternalAsync(Uri endpoint)
{
await Task.Run(() =>
{
webSocketTask = TestHelpers.MockHttpResponder.WebSocketAsync(endpoint);
this.webSocketTask = TestHelpers.MockHttpResponder.WebSocketAsync(endpoint);
this.IsConnected = true;
});
}
Expand All @@ -77,8 +77,8 @@ private async Task CloseInternalAsync()
{
await Task.Run(() =>
{
webSocketTask.Dispose();
webSocketTask = null;
this.webSocketTask.Dispose();
this.webSocketTask = null;
this.IsConnected = false;
});
}
Expand Down Expand Up @@ -115,9 +115,9 @@ private async Task StartListeningForMessagesInternalAsync()
{
while (this.keepListeningForMessages)
{
await webSocketTask.ConfigureAwait(false);
await this.webSocketTask.ConfigureAwait(false);

using (HttpResponseMessage response = webSocketTask.Result)
using (HttpResponseMessage response = this.webSocketTask.Result)
{
if (!response.IsSuccessStatusCode)
{
Expand Down Expand Up @@ -155,10 +155,10 @@ private async Task StartListeningForMessagesInternalAsync()
/// <returns>The task of sending the message to the websocket</returns>
private async Task SendMessageInternalAsync(string message)
{
await webSocketTask.ConfigureAwait(false);
webSocketTask.Wait();
await this.webSocketTask.ConfigureAwait(false);
this.webSocketTask.Wait();

using (HttpResponseMessage response = webSocketTask.Result)
using (HttpResponseMessage response = this.webSocketTask.Result)
{
if (!response.IsSuccessStatusCode)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public class PackageInfo
/// <returns> True if the package is sideloaded. </returns>
public bool IsSideloaded()
{
return (this.PackageOrigin == 4 || this.PackageOrigin == 5);
return this.PackageOrigin == 4 || this.PackageOrigin == 5;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,16 @@ public class FileOrFolderInformation
public long SizeInBytes { get; private set; }

/// <summary>
/// Gets whether the current item is a folder by checking for FILE_ATTRIBUTE_DIRECTORY
/// Gets a value indicating whether the current item is a folder by checking for FILE_ATTRIBUTE_DIRECTORY
/// See https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx
/// </summary>
public bool IsFolder { get { return (this.Type & 0x10) == 0x10; } }
public bool IsFolder
{
get
{
return (this.Type & 0x10) == 0x10;
}
}

/// <summary>
/// Overridden ToString method providing a user readable
Expand Down
Loading

0 comments on commit e69aa95

Please sign in to comment.