| 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/compositor.h" | 10 #include "ui/compositor/compositor.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 surface_map_.Clear(); | 109 surface_map_.Clear(); |
| 110 ui::TerminateContextFactoryForTests(); | 110 ui::TerminateContextFactoryForTests(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 scoped_ptr<content::BrowserCompositorOutputSurface> | 113 scoped_ptr<content::BrowserCompositorOutputSurface> |
| 114 SoftwareBrowserCompositorOutputSurfaceTest::CreateSurface( | 114 SoftwareBrowserCompositorOutputSurfaceTest::CreateSurface( |
| 115 scoped_ptr<cc::SoftwareOutputDevice> device) { | 115 scoped_ptr<cc::SoftwareOutputDevice> device) { |
| 116 return scoped_ptr<content::BrowserCompositorOutputSurface>( | 116 return scoped_ptr<content::BrowserCompositorOutputSurface>( |
| 117 new content::SoftwareBrowserCompositorOutputSurface( | 117 new content::SoftwareBrowserCompositorOutputSurface( |
| 118 surface_proxy_, | 118 surface_proxy_, device.Pass(), 1, &surface_map_)); |
| 119 device.Pass(), | |
| 120 1, | |
| 121 &surface_map_, | |
| 122 compositor_->vsync_manager())); | |
| 123 } | 119 } |
| 124 | 120 |
| 125 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { | 121 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { |
| 126 scoped_ptr<cc::SoftwareOutputDevice> software_device( | 122 scoped_ptr<cc::SoftwareOutputDevice> software_device( |
| 127 new cc::SoftwareOutputDevice()); | 123 new cc::SoftwareOutputDevice()); |
| 128 output_surface_ = CreateSurface(software_device.Pass()); | 124 output_surface_ = CreateSurface(software_device.Pass()); |
| 129 | 125 |
| 130 cc::CompositorFrame frame; | 126 cc::CompositorFrame frame; |
| 131 output_surface_->SwapBuffers(&frame); | 127 output_surface_->SwapBuffers(&frame); |
| 132 | 128 |
| 133 EXPECT_EQ(NULL, output_surface_->software_device()->GetVSyncProvider()); | 129 EXPECT_EQ(NULL, output_surface_->software_device()->GetVSyncProvider()); |
| 134 } | 130 } |
| 135 | 131 |
| 136 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { | 132 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { |
| 137 scoped_ptr<cc::SoftwareOutputDevice> software_device( | 133 scoped_ptr<cc::SoftwareOutputDevice> software_device( |
| 138 new FakeSoftwareOutputDevice()); | 134 new FakeSoftwareOutputDevice()); |
| 139 output_surface_ = CreateSurface(software_device.Pass()); | 135 output_surface_ = CreateSurface(software_device.Pass()); |
| 140 | 136 |
| 141 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 137 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
| 142 output_surface_->software_device()->GetVSyncProvider()); | 138 output_surface_->software_device()->GetVSyncProvider()); |
| 143 EXPECT_EQ(0, vsync_provider->call_count()); | 139 EXPECT_EQ(0, vsync_provider->call_count()); |
| 144 | 140 |
| 145 cc::CompositorFrame frame; | 141 cc::CompositorFrame frame; |
| 146 output_surface_->SwapBuffers(&frame); | 142 output_surface_->SwapBuffers(&frame); |
| 147 | 143 |
| 148 EXPECT_EQ(1, vsync_provider->call_count()); | 144 EXPECT_EQ(1, vsync_provider->call_count()); |
| 149 } | 145 } |
| OLD | NEW |