Skip to content

Commit 86caf51

Browse files
authored
Merge pull request #245 from MicrosoftEdge/smoketest/1.0.2584-testing
Update projects to use latest WebView2 SDK 1.0.2584-prerelease
2 parents bce5a77 + 75202cd commit 86caf51

14 files changed

+191
-8
lines changed

SampleApps/WebView2APISample/AppWindow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,8 @@ void AppWindow::RegisterEventHandlers()
17771777
static const wchar_t* browser_launching_domain = L"www.example.com";
17781778
wil::unique_bstr source_domain = GetDomainOfUri(source.get());
17791779
const wchar_t* source_domain_as_wchar = source_domain.get();
1780-
if (wcscmp(browser_launching_domain, source_domain_as_wchar) == 0)
1780+
if (source_domain_as_wchar &&
1781+
wcscmp(browser_launching_domain, source_domain_as_wchar) == 0)
17811782
{
17821783
// Open the URI in the default browser.
17831784
wil::unique_cotaskmem_string target_uri;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "stdafx.h"
6+
7+
#include "ScenarioScreenCapture.h"
8+
9+
#include "AppWindow.h"
10+
#include "CheckFailure.h"
11+
12+
using namespace Microsoft::WRL;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
#include "stdafx.h"
7+
8+
#include <string>
9+
10+
#include "AppWindow.h"
11+
#include "ComponentBase.h"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ScenarioScreenCaptureIFrame2</title>
5+
</head>
6+
<body>
7+
<h1>Screen Capture Test From Top Level IFrame 2</h1>
8+
<button onclick="testScreenCapture()">Screen Capture Test</button>
9+
<button id="toggleButton" onclick="toggleStatus()">Disable</button>
10+
<div id="statusDisplay"></div>
11+
<script>
12+
function testScreenCapture() {
13+
navigator.mediaDevices.getDisplayMedia();
14+
}
15+
16+
function toggleStatus() {
17+
var button = document.getElementById('toggleButton');
18+
var statusDisplay = document.getElementById('statusDisplay');
19+
if (button.innerHTML === "Enable") {
20+
chrome.webview.postMessage("EnableScreenCapture");
21+
button.innerHTML = "Disable";
22+
statusDisplay.innerHTML = "Status: Enabled";
23+
} else {
24+
chrome.webview.postMessage("DisableScreenCapture");
25+
button.innerHTML = "Enable";
26+
statusDisplay.innerHTML = "Status: Disabled";
27+
}
28+
}
29+
</script>
30+
31+
</body>
32+
</html>

SampleApps/WebView2APISample/SettingsComponent.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,12 @@ SettingsComponent::~SettingsComponent()
18141814
wil::unique_bstr GetDomainOfUri(PWSTR uri)
18151815
{
18161816
wil::com_ptr<IUri> uriObject;
1817-
CreateUri(uri, Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_DECODE_EXTRA_INFO, 0, &uriObject);
1817+
HRESULT hr = CreateUri(
1818+
uri, Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_DECODE_EXTRA_INFO, 0, &uriObject);
1819+
if (FAILED(hr))
1820+
{
1821+
return nullptr;
1822+
}
18181823
wil::unique_bstr domain;
18191824
uriObject->GetHost(&domain);
18201825
return domain;

SampleApps/WebView2APISample/WebView2APISample.vcxproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@
244244
<ClInclude Include="ScenarioNotificationReceived.h" />
245245
<ClInclude Include="ScenarioPermissionManagement.h" />
246246
<ClInclude Include="ScenarioSaveAs.h" />
247+
<ClInclude Include="ScenarioScreenCapture.h" />
247248
<ClInclude Include="ScenarioSharedBuffer.h" />
248249
<ClInclude Include="ScenarioSharedWorkerWRR.h" />
249250
<ClInclude Include="ScenarioThrottlingControl.h" />
@@ -295,6 +296,7 @@
295296
<ClCompile Include="ScenarioNotificationReceived.cpp" />
296297
<ClCompile Include="ScenarioPermissionManagement.cpp" />
297298
<ClCompile Include="ScenarioSaveAs.cpp" />
299+
<ClCompile Include="ScenarioScreenCapture.cpp" />
298300
<ClCompile Include="ScenarioSharedBuffer.cpp" />
299301
<ClCompile Include="ScenarioSharedWorkerWRR.cpp" />
300302
<ClCompile Include="ScenarioThrottlingControl.cpp" />
@@ -375,6 +377,15 @@
375377
<CopyFileToFolders Include="assets/ScenarioNotificationReceived.html">
376378
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
377379
</CopyFileToFolders>
380+
<CopyFileToFolders Include="assets/ScenarioScreenCapture.html">
381+
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
382+
</CopyFileToFolders>
383+
<CopyFileToFolders Include="assets/ScenarioScreenCaptureIFrame1.html">
384+
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
385+
</CopyFileToFolders>
386+
<CopyFileToFolders Include="assets/ScenarioScreenCaptureIFrame2.html">
387+
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
388+
</CopyFileToFolders>
378389
<CopyFileToFolders Include="assets/ScenarioSharedBuffer.html">
379390
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
380391
</CopyFileToFolders>
@@ -451,20 +462,23 @@
451462
<CopyFileToFolders Include="assets\ScenarioTestingFocus.html">
452463
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
453464
</CopyFileToFolders>
465+
<CopyFileToFolders Include="ScenarioScreenCaptureIFrame2.html">
466+
<DestinationFolders>$(OutDir)\assets</DestinationFolders>
467+
</CopyFileToFolders>
454468
</ItemGroup>
455469
<ItemGroup>
456470
<Midl Include="HostObjectSample.idl" TypeLibraryName="$(OutDir)WebView2APISample.tlb" />
457471
</ItemGroup>
458472
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
459473
<ImportGroup Label="ExtensionTargets">
460474
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
461-
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2526-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2526-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
475+
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2584-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2584-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
462476
</ImportGroup>
463477
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
464478
<PropertyGroup>
465479
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
466480
</PropertyGroup>
467481
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
468-
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2526-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2526-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
482+
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2584-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2584-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
469483
</Target>
470484
</Project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ScenarioScreenCapture</title>
5+
</head>
6+
<body>
7+
<h1>ScenarioScreenCapture Sample Page</h1>
8+
<h1>Screen Capture Test From Main Frame</h1>
9+
<button onclick="testScreenCapture()">Screen Capture Test</button>
10+
<button id="toggleButton" onclick="toggleStatus()">Disable</button>
11+
<div id="statusDisplay"></div>
12+
<script> function testScreenCapture() {
13+
navigator.mediaDevices.getDisplayMedia();
14+
}
15+
16+
function toggleStatus() {
17+
var button = document.getElementById('toggleButton');
18+
var statusDisplay = document.getElementById('statusDisplay');
19+
if (button.innerHTML === "Enable") {
20+
chrome.webview.postMessage("EnableScreenCapture");
21+
button.innerHTML = "Disable";
22+
statusDisplay.innerHTML = "Status: Enabled";
23+
} else {
24+
chrome.webview.postMessage("DisableScreenCapture");
25+
button.innerHTML = "Enable";
26+
statusDisplay.innerHTML = "Status: Disabled";
27+
}
28+
}
29+
</script>
30+
31+
<iframe src="ScenarioScreenCaptureIFrame1.html"
32+
name="iframe-toplevel1"
33+
title=""
34+
height="300"
35+
width="1000"> </iframe>
36+
37+
<iframe src="ScenarioScreenCaptureIFrame2.html"
38+
name="iframe-toplevel2"
39+
title=""
40+
height="300"
41+
width="1000"> </iframe>
42+
</body>
43+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ScenarioScreenCaptureIFrame1</title>
5+
</head>
6+
<body>
7+
<h1>Screen Capture Test From Top Level IFrame1</h1>
8+
<button onclick="testScreenCapture()">Screen Capture Test</button>
9+
<button id="toggleButton" onclick="toggleStatus()">Disable</button>
10+
<div id="statusDisplay"></div>
11+
<script>
12+
function testScreenCapture() {
13+
navigator.mediaDevices.getDisplayMedia();
14+
}
15+
16+
function toggleStatus() {
17+
var button = document.getElementById('toggleButton');
18+
var statusDisplay = document.getElementById('statusDisplay');
19+
if (button.innerHTML === "Enable") {
20+
chrome.webview.postMessage("EnableScreenCapture");
21+
button.innerHTML = "Disable";
22+
statusDisplay.innerHTML = "Status: Enabled";
23+
} else {
24+
chrome.webview.postMessage("DisableScreenCapture");
25+
button.innerHTML = "Enable";
26+
statusDisplay.innerHTML = "Status: Disabled";
27+
}
28+
}
29+
</script>
30+
31+
</body>
32+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ScenarioScreenCaptureIFrame2</title>
5+
</head>
6+
<body>
7+
<h1>Screen Capture Test From Top Level IFrame2</h1>
8+
<button onclick="testScreenCapture()">Screen Capture Test</button>
9+
<button id="toggleButton" onclick="toggleStatus()">Disable</button>
10+
<div id="statusDisplay"></div>
11+
<script>
12+
function testScreenCapture() {
13+
navigator.mediaDevices.getDisplayMedia();
14+
}
15+
16+
function toggleStatus() {
17+
var button = document.getElementById('toggleButton');
18+
var statusDisplay = document.getElementById('statusDisplay');
19+
if (button.innerHTML === "Enable") {
20+
chrome.webview.postMessage("EnableScreenCapture");
21+
button.innerHTML = "Disable";
22+
statusDisplay.innerHTML = "Status: Enabled";
23+
} else {
24+
chrome.webview.postMessage("DisableScreenCapture");
25+
button.innerHTML = "Enable";
26+
statusDisplay.innerHTML = "Status: Disabled";
27+
}
28+
}
29+
</script>
30+
31+
</body>
32+
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Web.WebView2" version="1.0.2526-prerelease" targetFramework="native" />
3+
<package id="Microsoft.Web.WebView2" version="1.0.2584-prerelease" targetFramework="native" />
44
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
55
</packages>

0 commit comments

Comments
 (0)