Skip to content

Commit 0ed5a8c

Browse files
Smoketest/1.0.1988 testing (#200)
* Updates for Win32, WPF and WinForms sample apps from 117.0.1988.0 * Updated package version for Win32, WPF and WinForms sample apps to 1.0.1988-prerelease --------- Co-authored-by: WebView2 Github Bot <[email protected]>
1 parent cb76e6d commit 0ed5a8c

30 files changed

+1694
-432
lines changed

SampleApps/WebView2APISample/AppWindow.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "ScenarioExtensionsManagement.h"
4040
#include "ScenarioIFrameDevicePermission.h"
4141
#include "ScenarioNavigateWithWebResourceRequest.h"
42+
#include "ScenarioNotificationReceived.h"
4243
#include "ScenarioPermissionManagement.h"
4344
#include "ScenarioSharedBuffer.h"
4445
#include "ScenarioSharedWorkerWRR.h"
@@ -50,7 +51,6 @@
5051
#include "SettingsComponent.h"
5152
#include "TextInputDialog.h"
5253
#include "ViewComponent.h"
53-
5454
using namespace Microsoft::WRL;
5555
static constexpr size_t s_maxLoadString = 100;
5656
static constexpr UINT s_runAsyncWindowMessage = WM_APP;
@@ -554,6 +554,16 @@ bool AppWindow::ExecuteWebViewCommands(WPARAM wParam, LPARAM lParam)
554554
L"CookieManagement", MB_OK);
555555
return true;
556556
}
557+
case IDM_SCENARIO_EXTENSIONS_MANAGEMENT_INSTALL_DEFAULT:
558+
{
559+
NewComponent<ScenarioExtensionsManagement>(this, false);
560+
return true;
561+
}
562+
case IDM_SCENARIO_EXTENSIONS_MANAGEMENT_OFFLOAD_DEFAULT:
563+
{
564+
NewComponent<ScenarioExtensionsManagement>(this, true);
565+
return true;
566+
}
557567
case IDM_SCENARIO_CUSTOM_SCHEME:
558568
{
559569
NewComponent<ScenarioCustomScheme>(this);
@@ -584,6 +594,11 @@ bool AppWindow::ExecuteWebViewCommands(WPARAM wParam, LPARAM lParam)
584594
NewComponent<ScenarioNavigateWithWebResourceRequest>(this);
585595
return true;
586596
}
597+
case IDM_SCENARIO_NOTIFICATION:
598+
{
599+
NewComponent<ScenarioNotificationReceived>(this);
600+
return true;
601+
}
587602
case IDM_SCENARIO_TESTING_FOCUS:
588603
{
589604
WCHAR testingFocusPath[] = L"ScenarioTestingFocus.html";
@@ -964,7 +979,7 @@ bool AppWindow::PrintToDefaultPrinter()
964979
printStatus == COREWEBVIEW2_PRINT_STATUS_SUCCEEDED)
965980
{
966981
message = L"Printing " + std::wstring(title.get()) +
967-
L" document to printer is succedded";
982+
L" document to printer is succeeded";
968983
}
969984
else if (
970985
errorCode == S_OK &&
@@ -1090,7 +1105,7 @@ bool AppWindow::PrintToPrinter()
10901105
if (errorCode == S_OK && printStatus == COREWEBVIEW2_PRINT_STATUS_SUCCEEDED)
10911106
{
10921107
message = L"Printing " + std::wstring(title.get()) +
1093-
L" document to printer is succedded";
1108+
L" document to printer is succeeded";
10941109
}
10951110
else if (
10961111
errorCode == S_OK &&
@@ -1298,6 +1313,12 @@ void AppWindow::InitializeWebView()
12981313
options5->put_EnableTrackingPrevention(m_TrackingPreventionEnabled ? TRUE : FALSE));
12991314
}
13001315

1316+
Microsoft::WRL::ComPtr<ICoreWebView2ExperimentalEnvironmentOptions> optionsExperimental;
1317+
if (options.As(&optionsExperimental) == S_OK)
1318+
{
1319+
CHECK_FAILURE(optionsExperimental->put_AreBrowserExtensionsEnabled(TRUE));
1320+
}
1321+
13011322
HRESULT hr = CreateCoreWebView2EnvironmentWithOptions(
13021323
subFolder, m_userDataFolder.c_str(), options.Get(),
13031324
Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>(
@@ -1353,11 +1374,11 @@ HRESULT AppWindow::OnCreateEnvironmentCompleted(
13531374
CHECK_FAILURE(result);
13541375
m_webViewEnvironment = environment;
13551376

1356-
if (m_webviewOption.entry == WebViewCreateEntry::EVER_FROM_CREATE_WITH_OPTION_MENU)
1377+
if (m_webviewOption.entry == WebViewCreateEntry::EVER_FROM_CREATE_WITH_OPTION_MENU
1378+
)
13571379
{
13581380
return CreateControllerWithOptions();
13591381
}
1360-
13611382
auto webViewEnvironment3 = m_webViewEnvironment.try_query<ICoreWebView2Environment3>();
13621383

13631384
if (webViewEnvironment3 && (m_dcompDevice || m_wincompCompositor))
@@ -1547,6 +1568,7 @@ HRESULT AppWindow::OnCreateCoreWebView2ControllerCompleted(
15471568
//! [AddVirtualHostNameToFolderMapping]
15481569
}
15491570
NewComponent<ScenarioPermissionManagement>(this);
1571+
NewComponent<ScenarioNotificationReceived>(this);
15501572

15511573
// We have a few of our own event handlers to register here as well
15521574
RegisterEventHandlers();

SampleApps/WebView2APISample/ClientCertificateSelectionDialog.cpp

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

5-
#include <ctime>
65
#include <Windows.h>
76

87
#include "stdafx.h"
98

109
#include "App.h"
11-
#include "resource.h"
1210
#include "ClientCertificateSelectionDialog.h"
13-
14-
std::wstring UnixEpochToDateTime(double value) {
15-
WCHAR rawResult[32] = {};
16-
std::time_t rawTime = std::time_t(value);
17-
struct tm timeStruct = {};
18-
gmtime_s(&timeStruct, &rawTime);
19-
_wasctime_s(rawResult, 32, &timeStruct);
20-
std::wstring result(rawResult);
21-
return result;
22-
}
11+
#include "Util.h"
12+
#include "resource.h"
2313

2414
static INT_PTR CALLBACK ClientCertificateSelectionBoxDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
2515
{
@@ -95,9 +85,13 @@ static INT_PTR CALLBACK ClientCertificateSelectionBoxDlg(HWND hDlg, UINT message
9585
int i = (int)SendMessage(hwndList, LB_GETITEMDATA, lbItem, 0);
9686

9787
TCHAR buff[MAX_PATH];
98-
StringCbPrintf(buff, ARRAYSIZE(buff),
88+
StringCbPrintf(
89+
buff, ARRAYSIZE(buff),
9990
TEXT("Subject: %s\nValid From: %s\nValid To: %s\nCertificate Kind: %s"),
100-
self->clientCertificates[i].Subject, UnixEpochToDateTime(self->clientCertificates[i].ValidFrom).c_str(), UnixEpochToDateTime(self->clientCertificates[i].ValidTo).c_str(), self->clientCertificates[i].CertificateKind);
91+
self->clientCertificates[i].Subject,
92+
Util::UnixEpochToDateTime(self->clientCertificates[i].ValidFrom).c_str(),
93+
Util::UnixEpochToDateTime(self->clientCertificates[i].ValidTo).c_str(),
94+
self->clientCertificates[i].CertificateKind);
10195

10296
SetDlgItemText(hDlg, IDC_CERTIFICATE_STATIC, buff);
10397
return TRUE;

SampleApps/WebView2APISample/ControlComponent.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ ControlComponent::~ControlComponent()
429429
m_webView->remove_FrameNavigationCompleted(m_frameNavigationCompletedToken);
430430
m_controller->remove_MoveFocusRequested(m_moveFocusRequestedToken);
431431
m_controller->remove_AcceleratorKeyPressed(m_acceleratorKeyPressedToken);
432-
433432
// Undo our modifications to the toolbar elements
434433
for (auto pair : m_tabbableWindows)
435434
{

SampleApps/WebView2APISample/ControlComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class ControlComponent : public ComponentBase
4040
wil::com_ptr<ICoreWebView2Controller> m_controller;
4141
wil::com_ptr<ICoreWebView2> m_webView;
4242
Toolbar* m_toolbar;
43-
4443
std::vector<std::pair<HWND, WNDPROC>> m_tabbableWindows;
4544

4645
EventRegistrationToken m_navigationStartingToken = {};
@@ -49,5 +48,6 @@ class ControlComponent : public ComponentBase
4948
EventRegistrationToken m_navigationCompletedToken = {};
5049
EventRegistrationToken m_moveFocusRequestedToken = {};
5150
EventRegistrationToken m_acceleratorKeyPressedToken = {};
51+
EventRegistrationToken m_unhandledKeyPressedToken = {};
5252
EventRegistrationToken m_frameNavigationCompletedToken = {};
5353
};

0 commit comments

Comments
 (0)