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 "cc/test/fake_output_surface_client.h" | 7 #include "cc/test/fake_output_surface_client.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { | 97 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { |
98 output_surface_.reset(); | 98 output_surface_.reset(); |
99 compositor_.reset(); | 99 compositor_.reset(); |
100 ui::TerminateContextFactoryForTests(); | 100 ui::TerminateContextFactoryForTests(); |
101 } | 101 } |
102 | 102 |
103 scoped_ptr<content::BrowserCompositorOutputSurface> | 103 scoped_ptr<content::BrowserCompositorOutputSurface> |
104 SoftwareBrowserCompositorOutputSurfaceTest::CreateSurface( | 104 SoftwareBrowserCompositorOutputSurfaceTest::CreateSurface( |
105 scoped_ptr<cc::SoftwareOutputDevice> device) { | 105 scoped_ptr<cc::SoftwareOutputDevice> device) { |
106 return scoped_ptr<content::BrowserCompositorOutputSurface>( | 106 return scoped_ptr<content::BrowserCompositorOutputSurface>( |
107 new content::SoftwareBrowserCompositorOutputSurface( | 107 new content::SoftwareBrowserCompositorOutputSurface(device.Pass())); |
108 device.Pass(), | |
109 compositor_->vsync_manager())); | |
110 } | 108 } |
111 | 109 |
112 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { | 110 TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { |
113 cc::FakeOutputSurfaceClient output_surface_client; | 111 cc::FakeOutputSurfaceClient output_surface_client; |
114 scoped_ptr<cc::SoftwareOutputDevice> software_device( | 112 scoped_ptr<cc::SoftwareOutputDevice> software_device( |
115 new cc::SoftwareOutputDevice()); | 113 new cc::SoftwareOutputDevice()); |
116 output_surface_ = CreateSurface(software_device.Pass()); | 114 output_surface_ = CreateSurface(software_device.Pass()); |
117 CHECK(output_surface_->BindToClient(&output_surface_client)); | 115 CHECK(output_surface_->BindToClient(&output_surface_client)); |
118 | 116 |
119 cc::CompositorFrame frame; | 117 cc::CompositorFrame frame; |
(...skipping 13 matching lines...) Expand all Loading... |
133 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 131 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
134 output_surface_->software_device()->GetVSyncProvider()); | 132 output_surface_->software_device()->GetVSyncProvider()); |
135 EXPECT_EQ(0, vsync_provider->call_count()); | 133 EXPECT_EQ(0, vsync_provider->call_count()); |
136 | 134 |
137 cc::CompositorFrame frame; | 135 cc::CompositorFrame frame; |
138 output_surface_->SwapBuffers(&frame); | 136 output_surface_->SwapBuffers(&frame); |
139 | 137 |
140 EXPECT_EQ(1, output_surface_client.swap_count()); | 138 EXPECT_EQ(1, output_surface_client.swap_count()); |
141 EXPECT_EQ(1, vsync_provider->call_count()); | 139 EXPECT_EQ(1, vsync_provider->call_count()); |
142 } | 140 } |
OLD | NEW |