@@ -1802,33 +1802,21 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
1802
1802
EXPECT_EQ (expectedGpuAddress, graphicsAllocation.getGpuAddress ());
1803
1803
}
1804
1804
1805
- TEST (ResidencyDataTest, givenResidencyDataWithOsContextWhenDestructorIsCalledThenDecrementRefCount) {
1806
- OsContext *osContext = new OsContext (nullptr );
1807
- osContext->incRefInternal ();
1808
- EXPECT_EQ (1 , osContext->getRefInternalCount ());
1809
- {
1810
- ResidencyData residencyData;
1811
- residencyData.addOsContext (osContext);
1812
- EXPECT_EQ (2 , osContext->getRefInternalCount ());
1813
- }
1814
- EXPECT_EQ (1 , osContext->getRefInternalCount ());
1815
- osContext->decRefInternal ();
1816
- }
1817
-
1818
- TEST (ResidencyDataTest, givenResidencyDataWhenAddTheSameOsContextTwiceThenIncrementRefCounterOnlyOnce) {
1819
- OsContext *osContext = new OsContext (nullptr );
1820
- ResidencyData residencyData;
1821
- EXPECT_EQ (0 , osContext->getRefInternalCount ());
1822
- residencyData.addOsContext (osContext);
1823
- EXPECT_EQ (1 , osContext->getRefInternalCount ());
1824
- residencyData.addOsContext (osContext);
1825
- EXPECT_EQ (1 , osContext->getRefInternalCount ());
1826
- }
1827
-
1828
1805
TEST (ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) {
1829
1806
auto osContext = new OsContext (nullptr );
1830
1807
OsAgnosticMemoryManager memoryManager;
1831
1808
memoryManager.registerOsContext (osContext);
1832
1809
EXPECT_EQ (1u , memoryManager.getOsContextCount ());
1833
1810
EXPECT_EQ (1 , osContext->getRefInternalCount ());
1834
1811
}
1812
+
1813
+ TEST (ResidencyDataTest, givenOsContextWhenItIsAddedToResidencyThenItCantBeOverwritten) {
1814
+ ResidencyData residency;
1815
+ OsContext osContext (nullptr );
1816
+ OsContext osContext2 (nullptr );
1817
+ EXPECT_EQ (nullptr , residency.osContext );
1818
+ residency.addOsContext (&osContext);
1819
+ EXPECT_EQ (&osContext, residency.osContext );
1820
+ residency.addOsContext (&osContext2);
1821
+ EXPECT_EQ (&osContext, residency.osContext );
1822
+ }
0 commit comments