Skip to content

Commit

Permalink
DanielWagnerHall: Correctly return Platform from DesiredCapabilities.…
Browse files Browse the repository at this point in the history
… Fixes issue 2195.

r13262
  • Loading branch information
illicitonion committed Aug 5, 2011
1 parent 407187c commit 647e47c
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 8 deletions.
16 changes: 16 additions & 0 deletions WebDriver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDriver", "dotnet\src\Web
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webdriver-server", "cpp\webdriver-server\webdriver-server.vcxproj", "{35A23A16-EF17-4CC3-8854-785025A304F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDriver.Remote.UnitTests", "dotnet\test\WebDriver.Remote.UnitTests\WebDriver.Remote.UnitTests.csproj", "{D9387770-DA92-4898-801F-F61255739D38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
Expand Down Expand Up @@ -390,6 +392,20 @@ Global
{35A23A16-EF17-4CC3-8854-785025A304F3}.Release|Win32.Build.0 = Release|Win32
{35A23A16-EF17-4CC3-8854-785025A304F3}.Release|x64.ActiveCfg = Release|x64
{35A23A16-EF17-4CC3-8854-785025A304F3}.Release|x64.Build.0 = Release|x64
{D9387770-DA92-4898-801F-F61255739D38}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|Win32.ActiveCfg = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Debug|x64.ActiveCfg = Debug|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|.NET.ActiveCfg = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|Any CPU.Build.0 = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|Win32.ActiveCfg = Release|Any CPU
{D9387770-DA92-4898-801F-F61255739D38}.Release|x64.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 1 addition & 8 deletions dotnet/src/WebDriver/Remote/DesiredCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,7 @@ public Platform Platform
{
get
{
Platform browserPlatform = new Platform(PlatformType.Any);
object capabilityValue = this.GetCapability(CapabilityType.BrowserName);
if (capabilityValue != null)
{
browserPlatform = capabilityValue as Platform;
}

return browserPlatform;
return this.GetCapability(CapabilityType.Platform) as Platform ?? new Platform(PlatformType.Any);
}

set
Expand Down
32 changes: 32 additions & 0 deletions dotnet/test/WebDriver.Remote.UnitTests/DesiredCapabilitiesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2011 Software Freedom Conservatory
// Copyright 2011 Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using NUnit.Framework;
using OpenQA.Selenium;

namespace OpenQA.Selenium.Remote
{
[TestFixture]
public class DesiredCapabilitiesTests
{
[Test]
public void ShouldGetPlatformFromDesiredCapabilities()
{
var platform = new Platform(PlatformType.Windows);
var capabilities = new DesiredCapabilities(null, null, platform);
Assert.AreEqual(platform.PlatformType, capabilities.Platform.PlatformType);
}
}
}
54 changes: 54 additions & 0 deletions dotnet/test/WebDriver.Remote.UnitTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// <copyright file="AssemblyInfo.cs" company="WebDriver Committers">
// Copyright 2007-2011 WebDriver committers
// Copyright 2007-2011 Google Inc.
// Portions copyright 2007 ThoughtWorks, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Selenium WebDriver Remote Unit tests")]
[assembly: AssemblyDescription("Selenium WebDriver Remote Unit tests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Selenium Committers")]
[assembly: AssemblyProduct("Selenium")]
[assembly: AssemblyCopyright("Copyright © Software Freedom Conservatory 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1bf6043a-a3ac-46a1-958a-a9fc971173cd")]

// Mark the assembly as CLSCompliant for use with all CLS languages
[assembly: CLSCompliant(true)]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D9387770-DA92-4898-801F-F61255739D38}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebDriver.Remote.UnitTests</RootNamespace>
<AssemblyName>WebDriver.Remote.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\cli\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\cli\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\..\third_party\csharp\nunit-2.5.9\framework\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DesiredCapabilitiesTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WebDriver\WebDriver.csproj">
<Project>{83C13931-B27C-425C-AAF0-5F96EEA4F173}</Project>
<Name>WebDriver</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

0 comments on commit 647e47c

Please sign in to comment.