| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "cc/output/compositor_frame.h" | 6 #include "cc/output/compositor_frame.h" |
| 7 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" | 7 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" |
| 8 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 8 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/compositor/test/context_factories_for_test.h" | 10 #include "ui/compositor/test/context_factories_for_test.h" |
| 11 #include "ui/gfx/vsync_provider.h" | 11 #include "ui/gfx/vsync_provider.h" |
| 12 #include "ui/gl/gl_implementation.h" | |
| 13 | 12 |
| 14 namespace { | 13 namespace { |
| 15 | 14 |
| 16 class FakeVSyncProvider : public gfx::VSyncProvider { | 15 class FakeVSyncProvider : public gfx::VSyncProvider { |
| 17 public: | 16 public: |
| 18 FakeVSyncProvider() : call_count_(0) {} | 17 FakeVSyncProvider() : call_count_(0) {} |
| 19 virtual ~FakeVSyncProvider() {} | 18 virtual ~FakeVSyncProvider() {} |
| 20 | 19 |
| 21 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) | 20 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) |
| 22 OVERRIDE { | 21 OVERRIDE { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 scoped_ptr<ui::Compositor> compositor_; | 72 scoped_ptr<ui::Compositor> compositor_; |
| 74 | 73 |
| 75 IDMap<content::BrowserCompositorOutputSurface> surface_map_; | 74 IDMap<content::BrowserCompositorOutputSurface> surface_map_; |
| 76 scoped_refptr<content::BrowserCompositorOutputSurfaceProxy> surface_proxy_; | 75 scoped_refptr<content::BrowserCompositorOutputSurfaceProxy> surface_proxy_; |
| 77 | 76 |
| 78 DISALLOW_COPY_AND_ASSIGN(SoftwareBrowserCompositorOutputSurfaceTest); | 77 DISALLOW_COPY_AND_ASSIGN(SoftwareBrowserCompositorOutputSurfaceTest); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 SoftwareBrowserCompositorOutputSurfaceTest:: | 80 SoftwareBrowserCompositorOutputSurfaceTest:: |
| 82 SoftwareBrowserCompositorOutputSurfaceTest() { | 81 SoftwareBrowserCompositorOutputSurfaceTest() { |
| 83 CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL)); | |
| 84 message_loop_.reset(new base::MessageLoopForUI); | 82 message_loop_.reset(new base::MessageLoopForUI); |
| 85 } | 83 } |
| 86 | 84 |
| 87 SoftwareBrowserCompositorOutputSurfaceTest:: | 85 SoftwareBrowserCompositorOutputSurfaceTest:: |
| 88 ~SoftwareBrowserCompositorOutputSurfaceTest() {} | 86 ~SoftwareBrowserCompositorOutputSurfaceTest() {} |
| 89 | 87 |
| 90 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { | 88 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { |
| 91 ui::InitializeContextFactoryForTests(false); | 89 ui::InitializeContextFactoryForTests(false); |
| 92 ui::Compositor::Initialize(); | 90 ui::Compositor::Initialize(); |
| 93 | 91 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 136 |
| 139 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 137 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
| 140 output_surface_->software_device()->GetVSyncProvider()); | 138 output_surface_->software_device()->GetVSyncProvider()); |
| 141 EXPECT_EQ(0, vsync_provider->call_count()); | 139 EXPECT_EQ(0, vsync_provider->call_count()); |
| 142 | 140 |
| 143 cc::CompositorFrame frame; | 141 cc::CompositorFrame frame; |
| 144 output_surface_->SwapBuffers(&frame); | 142 output_surface_->SwapBuffers(&frame); |
| 145 | 143 |
| 146 EXPECT_EQ(1, vsync_provider->call_count()); | 144 EXPECT_EQ(1, vsync_provider->call_count()); |
| 147 } | 145 } |
| OLD | NEW |