OLD | NEW |
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_command_buffer_stub.h" | 5 #include "content/common/gpu/gpu_command_buffer_stub.h" |
6 #include "content/common/gpu/gpu_memory_allocation.h" | 6 #include "content/common/gpu/gpu_memory_allocation.h" |
7 #include "content/common/gpu/gpu_memory_manager.h" | 7 #include "content/common/gpu/gpu_memory_manager.h" |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 return surface_state_; | 34 return surface_state_; |
35 } | 35 } |
36 | 36 |
37 virtual gfx::Size GetSurfaceSize() const { | 37 virtual gfx::Size GetSurfaceSize() const { |
38 return size_; | 38 return size_; |
39 } | 39 } |
40 virtual bool IsInSameContextShareGroup( | 40 virtual bool IsInSameContextShareGroup( |
41 const GpuCommandBufferStubBase& stub) const { | 41 const GpuCommandBufferStubBase& stub) const { |
42 return false; | 42 return false; |
43 } | 43 } |
44 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) { | |
45 } | |
46 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { | 44 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { |
47 allocation_ = alloc; | 45 allocation_ = alloc; |
48 } | 46 } |
49 }; | 47 }; |
50 | 48 |
51 class FakeCommandBufferStubWithoutSurface : public GpuCommandBufferStubBase { | 49 class FakeCommandBufferStubWithoutSurface : public GpuCommandBufferStubBase { |
52 public: | 50 public: |
53 GpuMemoryAllocation allocation_; | 51 GpuMemoryAllocation allocation_; |
54 std::vector<GpuCommandBufferStubBase*> share_group_; | 52 std::vector<GpuCommandBufferStubBase*> share_group_; |
55 | 53 |
(...skipping 14 matching lines...) Expand all Loading... |
70 | 68 |
71 virtual gfx::Size GetSurfaceSize() const { | 69 virtual gfx::Size GetSurfaceSize() const { |
72 return gfx::Size(); | 70 return gfx::Size(); |
73 } | 71 } |
74 virtual bool IsInSameContextShareGroup( | 72 virtual bool IsInSameContextShareGroup( |
75 const GpuCommandBufferStubBase& stub) const { | 73 const GpuCommandBufferStubBase& stub) const { |
76 return std::find(share_group_.begin(), | 74 return std::find(share_group_.begin(), |
77 share_group_.end(), | 75 share_group_.end(), |
78 &stub) != share_group_.end(); | 76 &stub) != share_group_.end(); |
79 } | 77 } |
80 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) { | |
81 } | |
82 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { | 78 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { |
83 allocation_ = alloc; | 79 allocation_ = alloc; |
84 } | 80 } |
85 }; | 81 }; |
86 | 82 |
87 class FakeClient : public GpuMemoryManagerClient { | 83 class FakeClient : public GpuMemoryManagerClient { |
88 public: | 84 public: |
89 std::vector<GpuCommandBufferStubBase*> stubs_; | 85 std::vector<GpuCommandBufferStubBase*> stubs_; |
90 | 86 |
91 virtual void AppendAllCommandBufferStubs( | 87 virtual void AppendAllCommandBufferStubs( |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 EXPECT_EQ(stats.size(), 3ul); | 666 EXPECT_EQ(stats.size(), 3ul); |
671 EXPECT_FALSE(stats[&stub1].visible); | 667 EXPECT_FALSE(stats[&stub1].visible); |
672 EXPECT_FALSE(stats[&stub2].visible); | 668 EXPECT_FALSE(stats[&stub2].visible); |
673 EXPECT_TRUE(stats[&stub3].visible); | 669 EXPECT_TRUE(stats[&stub3].visible); |
674 EXPECT_EQ(stub1allocation4, 0ul); | 670 EXPECT_EQ(stub1allocation4, 0ul); |
675 EXPECT_GE(stub2allocation4, 0ul); | 671 EXPECT_GE(stub2allocation4, 0ul); |
676 EXPECT_GT(stub3allocation4, 0ul); | 672 EXPECT_GT(stub3allocation4, 0ul); |
677 if (compositors_get_bonus_allocation) | 673 if (compositors_get_bonus_allocation) |
678 EXPECT_GT(stub3allocation4, stub3allocation3); | 674 EXPECT_GT(stub3allocation4, stub3allocation3); |
679 } | 675 } |
OLD | NEW |