Skip to content

Commit d56e43c

Browse files
authored
Merge pull request #285 from MicrosoftEdge/smoketest/1.0.3590-testing
Smoketest/1.0.3590 testing
2 parents 53cfed7 + cbb100e commit d56e43c

File tree

14 files changed

+1031
-6
lines changed

14 files changed

+1031
-6
lines changed

SampleApps/WebView2APISample/AppWindow.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "ScenarioSharedWorkerManager.h"
5555
#include "ScenarioSaveAs.h"
5656
#include "ScenarioScreenCapture.h"
57+
#include "ScenarioSensitivityLabel.h"
5758
#include "ScenarioSharedBuffer.h"
5859
#include "ScenarioSharedWorkerWRR.h"
5960
#include "ScenarioThrottlingControl.h"
@@ -630,6 +631,30 @@ bool AppWindow::ExecuteWebViewCommands(WPARAM wParam, LPARAM lParam)
630631
NewComponent<ScenarioNotificationReceived>(this);
631632
return true;
632633
}
634+
case IDM_SCENARIO_PIRM_SET_ALLOWLIST:
635+
{
636+
auto sensitivityLabelComponent = GetOrCreateComponent<ScenarioSensitivityLabel>();
637+
sensitivityLabelComponent->SetPageRestrictionManagerAllowlist();
638+
return true;
639+
}
640+
case IDM_SCENARIO_PIRM_CHECK_AVAILABILITY:
641+
{
642+
auto sensitivityLabelComponent = GetOrCreateComponent<ScenarioSensitivityLabel>();
643+
sensitivityLabelComponent->CheckPageRestrictionManagerAvailability();
644+
return true;
645+
}
646+
case IDM_SCENARIO_SENSITIVITY_LABEL_START_TEST:
647+
{
648+
auto sensitivityLabelComponent = GetOrCreateComponent<ScenarioSensitivityLabel>();
649+
sensitivityLabelComponent->LaunchLabelDemoPage();
650+
return true;
651+
}
652+
case IDM_SCENARIO_SENSITIVITY_LABEL_TOGGLE_EVENTS:
653+
{
654+
auto sensitivityLabelComponent = GetOrCreateComponent<ScenarioSensitivityLabel>();
655+
sensitivityLabelComponent->ToggleEventListener();
656+
return true;
657+
}
633658
case IDM_SCENARIO_TESTING_FOCUS:
634659
{
635660
WCHAR testingFocusPath[] = L"ScenarioTestingFocus.html";
@@ -1740,7 +1765,12 @@ void AppWindow::InitializeWebView()
17401765
//! [CreateCoreWebView2EnvironmentWithOptions]
17411766

17421767
std::wstring args;
1743-
args.append(L"--enable-features=ThirdPartyStoragePartitioning,PartitionedCookies");
1768+
// Page Interaction Restriction Manager requires msPageInteractionManagerWebview2 to be
1769+
// enabled from the args, as by default it's disabled in the browser. If you want to
1770+
// test these scenarios, this flag should be enabled.
1771+
args.append(
1772+
L"--enable-features=ThirdPartyStoragePartitioning,PartitionedCookies,"
1773+
L"msPageInteractionManagerWebview2");
17441774
auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
17451775
options->put_AdditionalBrowserArguments(args.c_str());
17461776
CHECK_FAILURE(

SampleApps/WebView2APISample/AppWindow.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ class AppWindow
131131

132132
template <class ComponentType> ComponentType* GetComponent();
133133

134+
template <class ComponentType> ComponentType* GetOrCreateComponent();
135+
134136
void DeleteComponent(ComponentBase* scenario);
135137

136138
// Runs a function by posting it to the event loop. Use this to do things
@@ -329,3 +331,14 @@ template <class ComponentType> ComponentType* AppWindow::GetComponent()
329331
}
330332
return nullptr;
331333
}
334+
335+
template <class ComponentType> ComponentType* AppWindow::GetOrCreateComponent()
336+
{
337+
auto component = GetComponent<ComponentType>();
338+
if (!component)
339+
{
340+
NewComponent<ComponentType>(this);
341+
component = GetComponent<ComponentType>();
342+
}
343+
return component;
344+
}

0 commit comments

Comments
 (0)