content/common/gpu/gpu_memory_manager_unittest.cc
// Test GpuMemoryManager::Manage functionality: Test changing the last used
// time of stubs when doing so causes change in which stubs surpass threshold.
// Expect frontbuffer to be dropped for the older stub.
Test GpuMemoryManager::Manage functionality: Test changing the last used
time of stubs when doing so causes change in which stubs surpass threshold.
Expect frontbuffer to be dropped for the older stub.
Test GpuMemoryManager :: Manage functionality : Test changing the last used time of stubs when doing so causes change in which stubs surpass threshold . Expect frontbuffer to be dropped for the older stub .
TEST_F(GpuMemoryManagerTest, TestManageChangingLastUsedTime) {
  FakeClient stub1(memmgr_, GenerateUniqueSurfaceId(), false, newer_),
             stub2(memmgr_, GenerateUniqueSurfaceId(), false, newer_),
             stub3(memmgr_, GenerateUniqueSurfaceId(), false, newer_),
             stub4(memmgr_, GenerateUniqueSurfaceId(), false, older_);
  FakeClient stub5(memmgr_), stub6(memmgr_);
  stub5.SetInSameShareGroup(&stub3);
  stub6.SetInSameShareGroup(&stub4);
  FakeClient stub7(memmgr_);
  stub7.SetInSameShareGroup(&stub3);
  Manage();
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub1.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub2.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub3.allocation_));
  EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub4.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceNo(stub5.allocation_));
  EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub6.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceNo(stub7.allocation_));
  memmgr_.TestingSetClientLastUsedTime(&stub3, older_);
  memmgr_.TestingSetClientLastUsedTime(&stub4, newer_);
  Manage();
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub1.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub2.allocation_));
  EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub3.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceYes(stub4.allocation_));
  EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub5.allocation_));
  EXPECT_TRUE(IsAllocationBackgroundForSurfaceNo(stub6.allocation_));
  EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub7.allocation_));
}
TEST_F ( GpuMemoryManagerTest , TestManageChangingLastUsedTime ) { FakeClient stub1 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , newer_ ) , stub2 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , newer_ ) , stub3 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , newer_ ) , stub4 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , older_ ) ; FakeClient stub5 ( memmgr_ ) , stub6 ( memmgr_ ) ; stub5 . SetInSameShareGroup ( & stub3 ) ; stub6 . SetInSameShareGroup ( & stub4 ) ; FakeClient stub7 ( memmgr_ ) ; stub7 . SetInSameShareGroup ( & stub3 ) ; Manage ( ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub1 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub2 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub3 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationHibernatedForSurfaceYes ( stub4 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceNo ( stub5 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationHibernatedForSurfaceNo ( stub6 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceNo ( stub7 . allocation_ ) ) ; memmgr_ . TestingSetClientLastUsedTime ( & stub3 , older_ ) ; memmgr_ . TestingSetClientLastUsedTime ( & stub4 , newer_ ) ; Manage ( ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub1 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub2 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationHibernatedForSurfaceYes ( stub3 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceYes ( stub4 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationHibernatedForSurfaceNo ( stub5 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationBackgroundForSurfaceNo ( stub6 . allocation_ ) ) ; EXPECT_TRUE ( IsAllocationHibernatedForSurfaceNo ( stub7 . allocation_ ) ) ; }
Test GpuMemoryManager::Manage functionality: Test changing the last used
time of stubs when doing so causes change in which stubs surpass threshold.
Test GpuMemoryManager :: Manage functionality : Test changing the last used time of stubs when doing so causes change in which stubs surpass threshold .