| 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 "content/browser/compositor/software_browser_compositor_output_surface.
h" | 5 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 std::move(device), compositor_->vsync_manager(), &begin_frame_source_); | 111 std::move(device), compositor_->vsync_manager(), &begin_frame_source_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { | 114 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { |
| 115 cc::FakeOutputSurfaceClient output_surface_client; | 115 cc::FakeOutputSurfaceClient output_surface_client; |
| 116 std::unique_ptr<cc::SoftwareOutputDevice> software_device( | 116 std::unique_ptr<cc::SoftwareOutputDevice> software_device( |
| 117 new cc::SoftwareOutputDevice()); | 117 new cc::SoftwareOutputDevice()); |
| 118 output_surface_ = CreateSurface(std::move(software_device)); | 118 output_surface_ = CreateSurface(std::move(software_device)); |
| 119 CHECK(output_surface_->BindToClient(&output_surface_client)); | 119 CHECK(output_surface_->BindToClient(&output_surface_client)); |
| 120 | 120 |
| 121 cc::CompositorFrame frame; | 121 std::unique_ptr<cc::CompositorFrame> frame(cc::CompositorFrame::Create()); |
| 122 output_surface_->SwapBuffers(&frame); | 122 output_surface_->SwapBuffers(std::move(frame)); |
| 123 | 123 |
| 124 EXPECT_EQ(1, output_surface_client.swap_count()); | 124 EXPECT_EQ(1, output_surface_client.swap_count()); |
| 125 EXPECT_EQ(NULL, output_surface_->software_device()->GetVSyncProvider()); | 125 EXPECT_EQ(NULL, output_surface_->software_device()->GetVSyncProvider()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { | 128 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { |
| 129 cc::FakeOutputSurfaceClient output_surface_client; | 129 cc::FakeOutputSurfaceClient output_surface_client; |
| 130 std::unique_ptr<cc::SoftwareOutputDevice> software_device( | 130 std::unique_ptr<cc::SoftwareOutputDevice> software_device( |
| 131 new FakeSoftwareOutputDevice()); | 131 new FakeSoftwareOutputDevice()); |
| 132 output_surface_ = CreateSurface(std::move(software_device)); | 132 output_surface_ = CreateSurface(std::move(software_device)); |
| 133 CHECK(output_surface_->BindToClient(&output_surface_client)); | 133 CHECK(output_surface_->BindToClient(&output_surface_client)); |
| 134 | 134 |
| 135 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 135 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
| 136 output_surface_->software_device()->GetVSyncProvider()); | 136 output_surface_->software_device()->GetVSyncProvider()); |
| 137 EXPECT_EQ(0, vsync_provider->call_count()); | 137 EXPECT_EQ(0, vsync_provider->call_count()); |
| 138 | 138 |
| 139 cc::CompositorFrame frame; | 139 std::unique_ptr<cc::CompositorFrame> frame(cc::CompositorFrame::Create()); |
| 140 output_surface_->SwapBuffers(&frame); | 140 output_surface_->SwapBuffers(std::move(frame)); |
| 141 | 141 |
| 142 EXPECT_EQ(1, output_surface_client.swap_count()); | 142 EXPECT_EQ(1, output_surface_client.swap_count()); |
| 143 EXPECT_EQ(1, vsync_provider->call_count()); | 143 EXPECT_EQ(1, vsync_provider->call_count()); |
| 144 } | 144 } |
| OLD | NEW |