content/common/gpu/gpu_memory_manager_unittest.cc
// Create fake stubs with every combination of {visibilty,last_use_time}
// and make sure they compare correctly.  Only compare stubs with surfaces.
// Expect {more visible, newer} surfaces to be more important, in that order.
Create fake stubs with every combination of {visibilty,last_use_time}
and make sure they compare correctly.  Only compare stubs with surfaces.
Expect {more visible, newer} surfaces to be more important, in that order.
Create fake stubs with every combination of { visibilty last_use_time } and make sure they compare correctly . Only compare stubs with surfaces . Expect { more visible newer } surfaces to be more important in that order .
TEST_F(GpuMemoryManagerTest, ComparatorTests) {
  FakeClient
      stub_true1(memmgr_, GenerateUniqueSurfaceId(), true, older_),
      stub_true2(memmgr_, GenerateUniqueSurfaceId(), true, newer_),
      stub_true3(memmgr_, GenerateUniqueSurfaceId(), true, newest_),
      stub_false1(memmgr_, GenerateUniqueSurfaceId(), false, older_),
      stub_false2(memmgr_, GenerateUniqueSurfaceId(), false, newer_),
      stub_false3(memmgr_, GenerateUniqueSurfaceId(), false, newest_);
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true1, &stub_true1));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true2, &stub_true2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true3, &stub_true3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_false1));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false2, &stub_false2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false3, &stub_false3));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true1, &stub_false1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true1, &stub_false2));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true1, &stub_false3));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true2, &stub_false1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true2, &stub_false2));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true2, &stub_false3));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true3, &stub_false1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true3, &stub_false2));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true3, &stub_false3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_true1));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_true2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_true3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false2, &stub_true1));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false2, &stub_true2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false2, &stub_true3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false3, &stub_true1));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false3, &stub_true2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false3, &stub_true3));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true2, &stub_true1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true3, &stub_true1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_true3, &stub_true2));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_false2, &stub_false1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_false3, &stub_false1));
  EXPECT_TRUE(memmgr_.TestingCompareClients(&stub_false3, &stub_false2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true1, &stub_true2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true1, &stub_true3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_true2, &stub_true3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_false2));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false1, &stub_false3));
  EXPECT_FALSE(memmgr_.TestingCompareClients(&stub_false2, &stub_false3));
}
TEST_F ( GpuMemoryManagerTest , ComparatorTests ) { FakeClient stub_true1 ( memmgr_ , GenerateUniqueSurfaceId ( ) , true , older_ ) , stub_true2 ( memmgr_ , GenerateUniqueSurfaceId ( ) , true , newer_ ) , stub_true3 ( memmgr_ , GenerateUniqueSurfaceId ( ) , true , newest_ ) , stub_false1 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , older_ ) , stub_false2 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , newer_ ) , stub_false3 ( memmgr_ , GenerateUniqueSurfaceId ( ) , false , newest_ ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_true1 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_true2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_true3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_false1 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_false2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_false3 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_false1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_false2 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_false3 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_false1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_false2 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_false3 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_false1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_false2 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_false3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_true1 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_true2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_true3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_true1 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_true2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_true3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_true1 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_true2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_true3 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_true1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_true1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_true3 , & stub_true2 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_false1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_false1 ) ) ; EXPECT_TRUE ( memmgr_ . TestingCompareClients ( & stub_false3 , & stub_false2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_true2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true1 , & stub_true3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_true2 , & stub_true3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_false2 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false1 , & stub_false3 ) ) ; EXPECT_FALSE ( memmgr_ . TestingCompareClients ( & stub_false2 , & stub_false3 ) ) ; }
Create fake stubs with every combination of {visibilty,last_use_time}
and make sure they compare correctly.
Create fake stubs with every combination of { visibilty last_use_time } and make sure they compare correctly .
// Should never be more important than self: // Visible should always be more important than non visible: // Not visible should never be more important than visible: // Newer should always be more important than older: // Older should never be more important than newer: