Index: content/common/gpu/gpu_memory_manager_unittest.cc |
diff --git a/content/common/gpu/gpu_memory_manager_unittest.cc b/content/common/gpu/gpu_memory_manager_unittest.cc |
index 501e481c7cf05bc3d36c76b3dc5c270f37ba989d..d7f33ed93c85800d3f8dfaabc40a0f8d92b1098a 100644 |
--- a/content/common/gpu/gpu_memory_manager_unittest.cc |
+++ b/content/common/gpu/gpu_memory_manager_unittest.cc |
@@ -198,8 +198,10 @@ TEST_F(GpuMemoryManagerTest, TestManageBasicFunctionality) { |
client_.stubs_.push_back(&stub4); |
Manage(); |
- EXPECT_EQ(stub1.allocation_, stub3.allocation_); |
- EXPECT_EQ(stub2.allocation_, stub4.allocation_); |
+ EXPECT_GT(stub1.allocation_.gpu_resource_size_in_bytes, 1ul); |
mmocny
2012/04/20 18:47:30
I am already working on making it clearer why and
|
+ EXPECT_EQ(stub2.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_GT(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
// Test stub without surface, with share group of multiple stubs. |
FakeCommandBufferStubWithoutSurface stub5; |
@@ -208,7 +210,7 @@ TEST_F(GpuMemoryManagerTest, TestManageBasicFunctionality) { |
client_.stubs_.push_back(&stub5); |
Manage(); |
- EXPECT_EQ(stub1.allocation_, stub5.allocation_); |
+ EXPECT_GT(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
} |
// Test GpuMemoryManager::Manage functionality: changing visibility. |
@@ -238,9 +240,11 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingVisibility) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub1.allocation_, stub3.allocation_); |
- EXPECT_EQ(stub2.allocation_, stub4.allocation_); |
- EXPECT_EQ(stub1.allocation_, stub5.allocation_); |
+ EXPECT_GT(stub1.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub2.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_GT(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub1.surface_state_.visible = false; |
stub2.surface_state_.visible = true; |
@@ -250,9 +254,11 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingVisibility) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, true); |
- EXPECT_EQ(stub1.allocation_, stub3.allocation_); |
- EXPECT_EQ(stub2.allocation_, stub4.allocation_); |
- EXPECT_EQ(stub2.allocation_, stub5.allocation_); |
+ EXPECT_EQ(stub1.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_GT(stub2.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
} |
// Test GpuMemoryManager::Manage functionality: Test more than threshold number |
@@ -288,9 +294,9 @@ TEST_F(GpuMemoryManagerTest, TestManageManyVisibleStubs) { |
EXPECT_EQ(stub3.allocation_.suggest_have_backbuffer, true); |
EXPECT_EQ(stub4.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub4.allocation_.suggest_have_backbuffer, true); |
- EXPECT_EQ(stub5.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub6.allocation_, stub2.allocation_); |
- EXPECT_EQ(stub7.allocation_, stub1.allocation_); |
+ EXPECT_GT(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub6.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub7.allocation_.gpu_resource_size_in_bytes, 1ul); |
} |
// Test GpuMemoryManager::Manage functionality: Test more than threshold number |
@@ -326,9 +332,9 @@ TEST_F(GpuMemoryManagerTest, TestManageManyNotVisibleStubs) { |
EXPECT_EQ(stub3.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub4.allocation_.suggest_have_frontbuffer, false); |
EXPECT_EQ(stub4.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub5.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub6.allocation_, stub4.allocation_); |
- EXPECT_EQ(stub7.allocation_, stub1.allocation_); |
+ EXPECT_EQ(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub6.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub7.allocation_.gpu_resource_size_in_bytes, 1ul); |
} |
// Test GpuMemoryManager::Manage functionality: Test changing the last used |
@@ -360,9 +366,9 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingLastUsedTime) { |
EXPECT_EQ(stub3.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub4.allocation_.suggest_have_frontbuffer, false); |
EXPECT_EQ(stub4.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub5.allocation_, stub3.allocation_); |
- EXPECT_EQ(stub6.allocation_, stub4.allocation_); |
- EXPECT_EQ(stub7.allocation_, stub3.allocation_); |
+ EXPECT_EQ(stub5.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub6.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub7.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub3.surface_state_.last_used_time = older_; |
stub4.surface_state_.last_used_time = newer_; |
@@ -372,9 +378,9 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingLastUsedTime) { |
EXPECT_EQ(stub3.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub4.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub4.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub5.allocation_, stub3.allocation_); |
- EXPECT_EQ(stub6.allocation_, stub4.allocation_); |
- EXPECT_EQ(stub7.allocation_, stub4.allocation_); |
+ EXPECT_EQ(stub5.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub6.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub7.allocation_.gpu_resource_size_in_bytes, 1ul); |
} |
// Test GpuMemoryManager::Manage functionality: Test changing importance of |
@@ -406,10 +412,10 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingImportanceShareGroup) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, true); |
- EXPECT_EQ(stub3.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub3.allocation_, stub2.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub2.allocation_); |
+ EXPECT_GT(stub1.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub2.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub1.surface_state_.visible = false; |
@@ -418,10 +424,10 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingImportanceShareGroup) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, true); |
- EXPECT_NE(stub3.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub3.allocation_, stub2.allocation_); |
- EXPECT_NE(stub4.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub2.allocation_); |
+ EXPECT_EQ(stub1.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_GT(stub2.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_GT(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub2.surface_state_.visible = false; |
@@ -430,10 +436,10 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingImportanceShareGroup) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub3.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub3.allocation_, stub2.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub2.allocation_); |
+ EXPECT_EQ(stub1.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub2.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub1.surface_state_.last_used_time = older_; |
@@ -442,10 +448,10 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingImportanceShareGroup) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, true); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, false); |
- EXPECT_NE(stub3.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub3.allocation_, stub2.allocation_); |
- EXPECT_NE(stub4.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub2.allocation_); |
+ EXPECT_EQ(stub1.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub2.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub3.allocation_.gpu_resource_size_in_bytes, 1ul); |
+ EXPECT_EQ(stub4.allocation_.gpu_resource_size_in_bytes, 1ul); |
stub2.surface_state_.last_used_time = older_; |
@@ -454,10 +460,10 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingImportanceShareGroup) { |
EXPECT_EQ(stub1.allocation_.suggest_have_backbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_frontbuffer, false); |
EXPECT_EQ(stub2.allocation_.suggest_have_backbuffer, false); |
- EXPECT_EQ(stub3.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub3.allocation_, stub2.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub1.allocation_); |
- EXPECT_EQ(stub4.allocation_, stub2.allocation_); |
+ EXPECT_EQ(stub1.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub2.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub3.allocation_.gpu_resource_size_in_bytes, 0ul); |
+ EXPECT_EQ(stub4.allocation_.gpu_resource_size_in_bytes, 0ul); |
} |
// Test GpuMemoryAllocation comparison operators: Iterate over all possible |