2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-01-24 04:42:40 +08:00
|
|
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2018-05-08 19:19:26 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "runtime/os_interface/windows/gdi_interface.h"
|
2018-05-15 18:13:16 +08:00
|
|
|
#include "unit_tests/mocks/mock_wddm20.h"
|
2018-05-08 02:42:00 +08:00
|
|
|
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
|
|
|
#include "unit_tests/os_interface/windows/gdi_dll_fixture.h"
|
2018-05-08 19:19:26 +08:00
|
|
|
#include "mock_gmm_memory.h"
|
|
|
|
#include "test.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-05-08 19:19:26 +08:00
|
|
|
namespace OCLRT {
|
2018-05-08 02:42:00 +08:00
|
|
|
struct WddmFixture {
|
2017-12-21 07:45:38 +08:00
|
|
|
virtual void SetUp() {
|
2018-05-11 15:44:37 +08:00
|
|
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
2018-05-10 17:42:41 +08:00
|
|
|
gdi = new MockGdi();
|
|
|
|
wddm->gdi.reset(gdi);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
virtual void TearDown(){};
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
std::unique_ptr<WddmMock> wddm;
|
2018-05-10 17:42:41 +08:00
|
|
|
MockGdi *gdi = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
|
|
|
void SetUp() override {
|
|
|
|
GdiDllFixture::SetUp();
|
2018-05-11 15:44:37 +08:00
|
|
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
void TearDown() override {
|
|
|
|
GdiDllFixture::TearDown();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2018-05-08 02:42:00 +08:00
|
|
|
|
|
|
|
std::unique_ptr<WddmMock> wddm;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
struct WddmInstrumentationGmmFixture {
|
2017-12-21 07:45:38 +08:00
|
|
|
virtual void SetUp() {
|
2018-05-11 15:44:37 +08:00
|
|
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
2018-05-09 03:57:36 +08:00
|
|
|
gmmMem = new ::testing::NiceMock<GmockGmmMemory>();
|
|
|
|
wddm->gmmMemory.reset(gmmMem);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2018-05-09 03:57:36 +08:00
|
|
|
virtual void TearDown() {}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-05-08 02:42:00 +08:00
|
|
|
std::unique_ptr<WddmMock> wddm;
|
|
|
|
GmockGmmMemory *gmmMem = nullptr;
|
|
|
|
};
|
2018-05-08 19:19:26 +08:00
|
|
|
|
|
|
|
typedef Test<WddmFixture> WddmTest;
|
|
|
|
typedef Test<WddmFixtureWithMockGdiDll> WddmTestWithMockGdiDll;
|
|
|
|
typedef Test<WddmInstrumentationGmmFixture> WddmInstrumentationTest;
|
|
|
|
typedef ::testing::Test WddmTestSingle;
|
|
|
|
} // namespace OCLRT
|