OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include <set> | 8 #include <set> |
6 | 9 |
7 #include "cc/test/test_context_provider.h" | 10 #include "cc/test/test_context_provider.h" |
8 #include "cc/test/test_web_graphics_context_3d.h" | 11 #include "cc/test/test_web_graphics_context_3d.h" |
9 #include "content/browser/compositor/buffer_queue.h" | 12 #include "content/browser/compositor/buffer_queue.h" |
10 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 13 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
11 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 14 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
12 #include "content/common/gpu/client/gl_helper.h" | 15 #include "content/common/gpu/client/gl_helper.h" |
13 #include "gpu/GLES2/gl2extchromium.h" | 16 #include "gpu/GLES2/gl2extchromium.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class StubBrowserGpuMemoryBufferManager : public BrowserGpuMemoryBufferManager { | 52 class StubBrowserGpuMemoryBufferManager : public BrowserGpuMemoryBufferManager { |
50 public: | 53 public: |
51 StubBrowserGpuMemoryBufferManager() | 54 StubBrowserGpuMemoryBufferManager() |
52 : BrowserGpuMemoryBufferManager(1, 1), allocate_succeeds_(true) {} | 55 : BrowserGpuMemoryBufferManager(1, 1), allocate_succeeds_(true) {} |
53 | 56 |
54 void set_allocate_succeeds(bool value) { allocate_succeeds_ = value; } | 57 void set_allocate_succeeds(bool value) { allocate_succeeds_ = value; } |
55 | 58 |
56 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForScanout( | 59 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForScanout( |
57 const gfx::Size& size, | 60 const gfx::Size& size, |
58 gfx::BufferFormat format, | 61 gfx::BufferFormat format, |
59 int32 surface_id) override { | 62 int32_t surface_id) override { |
60 if (allocate_succeeds_) | 63 if (allocate_succeeds_) |
61 return make_scoped_ptr<gfx::GpuMemoryBuffer>(new StubGpuMemoryBufferImpl); | 64 return make_scoped_ptr<gfx::GpuMemoryBuffer>(new StubGpuMemoryBufferImpl); |
62 return nullptr; | 65 return nullptr; |
63 } | 66 } |
64 | 67 |
65 private: | 68 private: |
66 bool allocate_succeeds_; | 69 bool allocate_succeeds_; |
67 }; | 70 }; |
68 | 71 |
69 class MockBufferQueue : public BufferQueue { | 72 class MockBufferQueue : public BufferQueue { |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); | 613 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); |
611 EXPECT_CALL(*mock_output_surface_, | 614 EXPECT_CALL(*mock_output_surface_, |
612 CopyBufferDamage(target_texture, source_texture, small_damage, _)) | 615 CopyBufferDamage(target_texture, source_texture, small_damage, _)) |
613 .Times(1); | 616 .Times(1); |
614 output_surface_->SwapBuffers(small_damage); | 617 output_surface_->SwapBuffers(small_damage); |
615 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); | 618 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); |
616 } | 619 } |
617 | 620 |
618 } // namespace | 621 } // namespace |
619 } // namespace content | 622 } // namespace content |
OLD | NEW |