Tests for shared binaries (#222)
* Fix existing tests * Add test with shared binaries
This commit is contained in:
Родитель
1389e84cbb
Коммит
bfa7bf7400
|
@ -10,6 +10,10 @@
|
|||
const std::wstring scribbleFileName = L"scribble.appx";
|
||||
const std::wstring scribblePackageFullName = L"ScribbleOleDocumentSample_1.1.0.0_x86__8wekyb3d8bbwe";
|
||||
const std::wstring windows10PackageRoot = L"C:\\Program Files\\Windowsapps";
|
||||
const std::wstring notepadplusFileName = L"notepadplus.msix";
|
||||
const std::wstring notepadplusFullName = L"notepadplus_0.0.0.0_x64__8wekyb3d8bbwe";
|
||||
const std::wstring notepadplusCopyFileName = L"notepadplusCopy.msix";
|
||||
const std::wstring notepadplusCopyFullName = L"notepadplusCopy_0.0.0.0_x64__8wekyb3d8bbwe";
|
||||
|
||||
MsixCoreTest::~MsixCoreTest()
|
||||
{
|
||||
|
@ -47,7 +51,7 @@ bool MsixCoreTest::CleanupMethod()
|
|||
void MsixCoreTest::VerifyPackageInstalled(std::wstring & packageFullName)
|
||||
{
|
||||
std::unique_ptr<std::vector<std::shared_ptr<MsixCoreLib::IInstalledPackage>>> packages;
|
||||
VERIFY_SUCCEEDED(m_packageManager->FindPackages(packages));
|
||||
VERIFY_SUCCEEDED(m_packageManager->FindPackages(L"*", packages));
|
||||
|
||||
bool found = false;
|
||||
for (auto& package : *packages)
|
||||
|
@ -122,7 +126,7 @@ void MsixCoreTest::InstallIStreamPackageTest()
|
|||
VERIFY_SUCCEEDED(m_packageManager->AddPackage(packageStream, DeploymentOptions::None));
|
||||
|
||||
std::unique_ptr<std::vector<std::shared_ptr<MsixCoreLib::IInstalledPackage>>> packages;
|
||||
VERIFY_SUCCEEDED(m_packageManager->FindPackages(packages));
|
||||
VERIFY_SUCCEEDED(m_packageManager->FindPackages(L"*", packages));
|
||||
|
||||
bool found = false;
|
||||
for (auto& package : *packages)
|
||||
|
@ -213,4 +217,32 @@ void MsixCoreTest::InstallFromEmbeddedStreamTest()
|
|||
VerifyPackageInstalled(expectedPackageFullName);
|
||||
|
||||
VERIFY_SUCCEEDED(m_packageManager->RemovePackage(expectedPackageFullName));
|
||||
}
|
||||
|
||||
void MsixCoreTest::TestSharedBinaries()
|
||||
{
|
||||
//Install first package
|
||||
std::wstring packagePath = std::wstring(m_testDeploymentDir) + L"\\" + notepadplusFileName;
|
||||
std::wstring expectedPackageFullName = notepadplusFullName;
|
||||
VERIFY_SUCCEEDED(m_packageManager->AddPackage(packagePath, DeploymentOptions::None));
|
||||
VerifyPackageInstalled(expectedPackageFullName);
|
||||
|
||||
//Install second package with same binary
|
||||
std::wstring packagePathSecond = std::wstring(m_testDeploymentDir) + L"\\" + notepadplusCopyFileName;
|
||||
std::wstring expectedPackageFullNameSecond = notepadplusCopyFullName;
|
||||
VERIFY_SUCCEEDED(m_packageManager->AddPackage(packagePathSecond, DeploymentOptions::None));
|
||||
VerifyPackageInstalled(expectedPackageFullNameSecond);
|
||||
|
||||
//Remove first package
|
||||
VERIFY_SUCCEEDED(m_packageManager->RemovePackage(expectedPackageFullName));
|
||||
|
||||
//the exe file in the actual location should still exist
|
||||
std::wstring notepadExeName = L"C:\\Program Files (x86)\\Notepad++\\notepad++.exe";
|
||||
VERIFY_IS_TRUE(std::experimental::filesystem::exists(notepadExeName));
|
||||
|
||||
//Remove second package
|
||||
VERIFY_SUCCEEDED(m_packageManager->RemovePackage(expectedPackageFullNameSecond));
|
||||
|
||||
//After removing second package with shared binary, the exe should now not exist
|
||||
VERIFY_IS_TRUE(!std::experimental::filesystem::exists(notepadExeName));
|
||||
}
|
|
@ -34,6 +34,10 @@ public:
|
|||
BEGIN_TEST_METHOD(InstallFromEmbeddedStreamTest)
|
||||
TEST_METHOD_PROPERTY(L"RunAs", L"ElevatedUser")
|
||||
END_TEST_METHOD()
|
||||
|
||||
BEGIN_TEST_METHOD(TestSharedBinaries)
|
||||
TEST_METHOD_PROPERTY(L"RunAs", L"ElevatedUser")
|
||||
END_TEST_METHOD()
|
||||
private:
|
||||
MsixCoreLib::IPackageManager * m_packageManager;
|
||||
WEX::Common::String m_testDeploymentDir;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:141ed9f54048786a664274a6884f846bd436e7e24592f1ef98c00c94c58ff475
|
||||
size 3112186
|
Загрузка…
Ссылка в новой задаче