Skip to content

Commit 96aea4b

Browse files
committed
Merge branch 'master' of https://github.com/Geevo/CefSharp
2 parents daf8983 + 43f37dc commit 96aea4b

File tree

19 files changed

+185
-234
lines changed

19 files changed

+185
-234
lines changed

CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\cef.sdk.81.3.2\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.81.3.2\build\cef.sdk.props')" />
3+
<Import Project="..\packages\cef.sdk.81.3.10\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.81.3.10\build\cef.sdk.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|Win32">
66
<Configuration>Debug</Configuration>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="cef.sdk" version="81.3.2" targetFramework="native" />
3+
<package id="cef.sdk" version="81.3.10" targetFramework="native" />
44
</packages>

CefSharp.Core/Cef.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,17 @@ namespace CefSharp
805805
extension = extension->Substring(1, extension->Length - 1);
806806
}
807807

808-
return StringUtils::ToClr(CefGetMimeType(StringUtils::ToNative(extension)));
808+
auto mimeType = StringUtils::ToClr(CefGetMimeType(StringUtils::ToNative(extension)));
809+
810+
//Lookup to see if we have a custom mapping
811+
//MimeTypeMapping::GetCustomMapping will Fallback
812+
//to application/octet-stream if no mapping found
813+
if (String::IsNullOrEmpty(mimeType))
814+
{
815+
return MimeTypeMapping::GetCustomMapping(extension);
816+
}
817+
818+
return mimeType;
809819
}
810820

811821
/// <summary>

CefSharp.Core/CefSharp.Core.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\cef.sdk.81.3.2\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.81.3.2\build\cef.sdk.props')" />
3+
<Import Project="..\packages\cef.sdk.81.3.10\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.81.3.10\build\cef.sdk.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|Win32">
66
<Configuration>Debug</Configuration>

CefSharp.Core/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="cef.sdk" version="81.3.2" targetFramework="native" />
3+
<package id="cef.sdk" version="81.3.10" targetFramework="native" />
44
</packages>

CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\cef.redist.x86.81.3.2\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.81.3.2\build\cef.redist.x86.props')" />
4-
<Import Project="..\packages\cef.redist.x64.81.3.2\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.81.3.2\build\cef.redist.x64.props')" />
3+
<Import Project="..\packages\cef.redist.x86.81.3.10\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.81.3.10\build\cef.redist.x86.props')" />
4+
<Import Project="..\packages\cef.redist.x64.81.3.10\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.81.3.10\build\cef.redist.x64.props')" />
55
<Import Project="..\packages\Microsoft.Net.Compilers.2.9.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.9.0\build\Microsoft.Net.Compilers.props')" />
66
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
77
<PropertyGroup>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="cef.redist.x64" version="81.3.2" targetFramework="net462" />
4-
<package id="cef.redist.x86" version="81.3.2" targetFramework="net462" />
3+
<package id="cef.redist.x64" version="81.3.10" targetFramework="net462" />
4+
<package id="cef.redist.x86" version="81.3.10" targetFramework="net462" />
55
<package id="Microsoft.Net.Compilers" version="2.9.0" targetFramework="net462" developmentDependency="true" />
66
</packages>

CefSharp.Test/CefSharp.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\cef.redist.x86.81.3.2\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.81.3.2\build\cef.redist.x86.props')" />
4-
<Import Project="..\packages\cef.redist.x64.81.3.2\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.81.3.2\build\cef.redist.x64.props')" />
3+
<Import Project="..\packages\cef.redist.x86.81.3.10\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.81.3.10\build\cef.redist.x86.props')" />
4+
<Import Project="..\packages\cef.redist.x64.81.3.10\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.81.3.10\build\cef.redist.x64.props')" />
55
<Import Project="..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" />
66
<PropertyGroup>
77
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -128,6 +128,7 @@
128128
<Compile Include="Framework\BinderFacts.cs" />
129129
<Compile Include="Framework\AsyncExtensionFacts.cs" />
130130
<Compile Include="Framework\ConcurrentMethodRunnerQueueFacts.cs" />
131+
<Compile Include="Framework\MimeTypeMappingFacts.cs" />
131132
<Compile Include="Framework\PathCheckFacts.cs" />
132133
<Compile Include="OffScreen\OffScreenBrowserBasicFacts.cs" />
133134
<Compile Include="CefSharpXunitTestFramework.cs" />

CefSharp.Test/Framework/BinderFacts.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//
33
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
44

5+
using System;
56
using System.Collections.Generic;
67
using CefSharp.ModelBinding;
78
using Xunit;
@@ -86,5 +87,64 @@ public void BindsDoublesWithoutPrecisionLoss()
8687

8788
Assert.Equal(2.0, result);
8889
}
90+
91+
[Theory]
92+
[InlineData(0, typeof(int))]
93+
[InlineData(0d, typeof(double))]
94+
[InlineData(false, typeof(bool))]
95+
public void NullToValueTypeTheory(object excepectedResult, Type conversionType)
96+
{
97+
var binder = new DefaultBinder();
98+
99+
var actualResult = binder.Bind(null, conversionType);
100+
101+
Assert.Equal(excepectedResult, actualResult);
102+
}
103+
104+
[Fact]
105+
public void BindArrayWithNullElementToIntArray()
106+
{
107+
var arrayType = typeof(int[]);
108+
109+
var binder = new DefaultBinder();
110+
var obj = new List<object> { 10, 20, null, 30 };
111+
var result = binder.Bind(obj, arrayType);
112+
113+
Assert.NotNull(result);
114+
Assert.Equal(arrayType, result.GetType());
115+
116+
var arr = (int[])result;
117+
Assert.Equal(obj.Count, arr.Length);
118+
119+
for (int i = 0; i < obj.Count; i++)
120+
{
121+
var expected = obj[i] ?? 0;
122+
var actual = arr[i];
123+
Assert.Equal(expected, actual);
124+
}
125+
}
126+
127+
[Fact]
128+
public void BindListOfNumbersToDoubleArray()
129+
{
130+
var doubleArrayType = typeof(double[]);
131+
132+
var binder = new DefaultBinder();
133+
var obj = new List<object> { 10, 20, 1.23 };
134+
var result = binder.Bind(obj, doubleArrayType);
135+
136+
Assert.NotNull(result);
137+
Assert.Equal(doubleArrayType, result.GetType());
138+
139+
var arr = (double[])result;
140+
Assert.Equal(obj.Count, arr.Length);
141+
142+
for (int i = 0; i < obj.Count; i++)
143+
{
144+
var expected = Convert.ToDouble(obj[i]);
145+
var actual = arr[i];
146+
Assert.Equal(expected, actual);
147+
}
148+
}
89149
}
90150
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright © 2020 The CefSharp Authors. All rights reserved.
2+
//
3+
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
using Xunit;
6+
7+
namespace CefSharp.Test.Framework
8+
{
9+
/// <summary>
10+
/// MimeTypeMappingFacts - Tests file extension to mimeType mapping
11+
/// </summary>
12+
public class MimeTypeMappingFacts
13+
{
14+
[Theory]
15+
[InlineData("html", "text/html")]
16+
[InlineData(".wasm", "application/wasm")]
17+
[InlineData(".ogg", "audio/ogg")]
18+
[InlineData(".oga", "audio/ogg")]
19+
[InlineData(".ogv", "video/ogg")]
20+
[InlineData(".opus", "audio/ogg")]
21+
[InlineData(".webm", "video/webm")]
22+
[InlineData(".weba", "audio/webm")]
23+
[InlineData(".webp", "image/webp")]
24+
[InlineData(".epub", "application/epub+zip")]
25+
[InlineData(".woff", "application/font-woff")]
26+
[InlineData(".woff2", "font/woff2")]
27+
[InlineData(".ttf", "font/ttf")]
28+
[InlineData(".otf", "font/otf")]
29+
[InlineData(".dummyextension", "application/octet-stream")]
30+
public void MapFileExtensionToMimeTypeTheory(string fileExtension, string expectedMimeType)
31+
{
32+
var actualMimeType = Cef.GetMimeType(fileExtension);
33+
Assert.Equal(expectedMimeType, actualMimeType);
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)