Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: content/common/gpu/gpu_memory_manager_unittest.cc

Issue 12208134: Revert 181950 - Broke content_unittests on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_memory_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/gpu_memory_allocation.h" 5 #include "content/common/gpu/gpu_memory_allocation.h"
6 #include "content/common/gpu/gpu_memory_manager.h" 6 #include "content/common/gpu/gpu_memory_manager.h"
7 #include "content/common/gpu/gpu_memory_manager_client.h" 7 #include "content/common/gpu/gpu_memory_manager_client.h"
8 #include "content/common/gpu/gpu_memory_tracking.h" 8 #include "content/common/gpu/gpu_memory_tracking.h"
9 #include "ui/gfx/size_conversions.h" 9 #include "ui/gfx/size_conversions.h"
10 10
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 // Background stubs 1 and 2, and they should fit. All stubs should 917 // Background stubs 1 and 2, and they should fit. All stubs should
918 // have their full nicetohave budget should they become visible. 918 // have their full nicetohave budget should they become visible.
919 stub2.SetVisible(false); 919 stub2.SetVisible(false);
920 stub1.SetVisible(false); 920 stub1.SetVisible(false);
921 Manage(); 921 Manage();
922 EXPECT_GE(stub1.BytesWhenVisible(), 23u); 922 EXPECT_GE(stub1.BytesWhenVisible(), 23u);
923 EXPECT_GE(stub2.BytesWhenVisible(), 23u); 923 EXPECT_GE(stub2.BytesWhenVisible(), 23u);
924 EXPECT_GE(stub3.BytesWhenVisible(), 23u); 924 EXPECT_GE(stub3.BytesWhenVisible(), 23u);
925 EXPECT_LT(stub1.BytesWhenVisible(), 32u); 925 EXPECT_LT(stub1.BytesWhenVisible(), 32u);
926 EXPECT_LT(stub2.BytesWhenVisible(), 32u); 926 EXPECT_LT(stub2.BytesWhenVisible(), 32u);
927 EXPECT_LT(stub3.BytesWhenVisible(), 32u);
927 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); 928 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u);
928 EXPECT_GE(stub2.BytesWhenNotVisible(), 6u); 929 EXPECT_GE(stub2.BytesWhenNotVisible(), 6u);
929 EXPECT_GE(stub3.BytesWhenNotVisible(), 6u); 930 EXPECT_GE(stub3.BytesWhenNotVisible(), 6u);
930 931
931 // Now background stub 3, and it should cause stub 2 to be 932 // Now background stub 3, and it should cause stub 2 to be
932 // evicted because it was set non-visible first 933 // evicted because it was set non-visible first
933 stub3.SetVisible(false); 934 stub3.SetVisible(false);
934 Manage(); 935 Manage();
935 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); 936 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u);
936 EXPECT_EQ(stub2.BytesWhenNotVisible(), 0u); 937 EXPECT_EQ(stub2.BytesWhenNotVisible(), 0u);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 TEST_F(GpuMemoryManagerTestNonuniform, DefaultAllocation) { 1034 TEST_F(GpuMemoryManagerTestNonuniform, DefaultAllocation) {
1034 // Set memory manager constants for this test 1035 // Set memory manager constants for this test
1035 memmgr_.TestingSetUseNonuniformMemoryPolicy(true); 1036 memmgr_.TestingSetUseNonuniformMemoryPolicy(true);
1036 memmgr_.TestingSetAvailableGpuMemory(64); 1037 memmgr_.TestingSetAvailableGpuMemory(64);
1037 memmgr_.TestingSetNonvisibleAvailableGpuMemory(16); 1038 memmgr_.TestingSetNonvisibleAvailableGpuMemory(16);
1038 memmgr_.TestingSetMinimumClientAllocation(8); 1039 memmgr_.TestingSetMinimumClientAllocation(8);
1039 memmgr_.TestingSetDefaultClientAllocation(16); 1040 memmgr_.TestingSetDefaultClientAllocation(16);
1040 1041
1041 FakeClient stub1(&memmgr_, GenerateUniqueSurfaceId(), true); 1042 FakeClient stub1(&memmgr_, GenerateUniqueSurfaceId(), true);
1042 1043
1043 // Expect that a client which has not sent stats receive at 1044 // Expect that a client which has not sent stats receive the
1044 // least the default allocation. 1045 // default allocation.
1045 Manage(); 1046 Manage();
1046 EXPECT_GE(stub1.BytesWhenVisible(), 1047 EXPECT_EQ(stub1.BytesWhenVisible(),
1047 memmgr_.GetDefaultClientAllocation()); 1048 memmgr_.GetDefaultClientAllocation());
1048 EXPECT_EQ(stub1.BytesWhenNotVisible(), 0u); 1049 EXPECT_EQ(stub1.BytesWhenNotVisible(), 0u);
1049 } 1050 }
1050 1051
1051 } // namespace content 1052 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698