| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "cc/test/test_context_provider.h" | 7 #include "cc/test/test_context_provider.h" |
| 8 #include "cc/test/test_web_graphics_context_3d.h" | 8 #include "cc/test/test_web_graphics_context_3d.h" |
| 9 #include "content/browser/compositor/buffer_queue.h" | 9 #include "content/browser/compositor/buffer_queue.h" |
| 10 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 10 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class StubGpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | 25 class StubGpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
| 26 public: | 26 public: |
| 27 StubGpuMemoryBufferImpl() {} | 27 StubGpuMemoryBufferImpl() {} |
| 28 | 28 |
| 29 // Overridden from gfx::GpuMemoryBuffer: | 29 // Overridden from gfx::GpuMemoryBuffer: |
| 30 bool Map(void** data) override { return false; } | 30 bool Map(void** data) override { return false; } |
| 31 void Unmap() override {} | 31 void Unmap() override {} |
| 32 bool IsMapped() const override { return false; } | 32 bool IsMapped() const override { return false; } |
| 33 Format GetFormat() const override { return gfx::GpuMemoryBuffer::RGBX_8888; } | 33 gfx::BufferFormat GetFormat() const override { |
| 34 return gfx::BufferFormat::RGBX_8888; |
| 35 } |
| 34 void GetStride(int* stride) const override {} | 36 void GetStride(int* stride) const override {} |
| 35 gfx::GpuMemoryBufferId GetId() const override { return 0; } | 37 gfx::GpuMemoryBufferId GetId() const override { return 0; } |
| 36 gfx::GpuMemoryBufferHandle GetHandle() const override { | 38 gfx::GpuMemoryBufferHandle GetHandle() const override { |
| 37 return gfx::GpuMemoryBufferHandle(); | 39 return gfx::GpuMemoryBufferHandle(); |
| 38 } | 40 } |
| 39 ClientBuffer AsClientBuffer() override { | 41 ClientBuffer AsClientBuffer() override { |
| 40 return reinterpret_cast<ClientBuffer>(this); | 42 return reinterpret_cast<ClientBuffer>(this); |
| 41 } | 43 } |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 class StubBrowserGpuMemoryBufferManager : public BrowserGpuMemoryBufferManager { | 46 class StubBrowserGpuMemoryBufferManager : public BrowserGpuMemoryBufferManager { |
| 45 public: | 47 public: |
| 46 StubBrowserGpuMemoryBufferManager() : BrowserGpuMemoryBufferManager(1) {} | 48 StubBrowserGpuMemoryBufferManager() : BrowserGpuMemoryBufferManager(1) {} |
| 47 | 49 |
| 48 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForScanout( | 50 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForScanout( |
| 49 const gfx::Size& size, | 51 const gfx::Size& size, |
| 50 gfx::GpuMemoryBuffer::Format format, | 52 gfx::BufferFormat format, |
| 51 int32 surface_id) override { | 53 int32 surface_id) override { |
| 52 return make_scoped_ptr<gfx::GpuMemoryBuffer>(new StubGpuMemoryBufferImpl); | 54 return make_scoped_ptr<gfx::GpuMemoryBuffer>(new StubGpuMemoryBufferImpl); |
| 53 } | 55 } |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 class MockBufferQueue : public BufferQueue { | 58 class MockBufferQueue : public BufferQueue { |
| 57 public: | 59 public: |
| 58 MockBufferQueue(scoped_refptr<cc::ContextProvider> context_provider, | 60 MockBufferQueue(scoped_refptr<cc::ContextProvider> context_provider, |
| 59 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager, | 61 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 60 unsigned int target, | 62 unsigned int target, |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // All free buffers should be destroyed, the remaining buffers should all | 548 // All free buffers should be destroyed, the remaining buffers should all |
| 547 // be replaced but still valid. | 549 // be replaced but still valid. |
| 548 EXPECT_EQ(1U, in_flight_surfaces().size()); | 550 EXPECT_EQ(1U, in_flight_surfaces().size()); |
| 549 EXPECT_EQ(0U, available_surfaces().size()); | 551 EXPECT_EQ(0U, available_surfaces().size()); |
| 550 EXPECT_TRUE(displayed_frame().texture); | 552 EXPECT_TRUE(displayed_frame().texture); |
| 551 EXPECT_TRUE(current_frame().texture); | 553 EXPECT_TRUE(current_frame().texture); |
| 552 } | 554 } |
| 553 | 555 |
| 554 } // namespace | 556 } // namespace |
| 555 } // namespace content | 557 } // namespace content |
| OLD | NEW |