| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 cc::DelayBasedBeginFrameSource begin_frame_source_; | 88 cc::DelayBasedBeginFrameSource begin_frame_source_; |
| 89 std::unique_ptr<ui::Compositor> compositor_; | 89 std::unique_ptr<ui::Compositor> compositor_; |
| 90 int update_vsync_parameters_call_count_ = 0; | 90 int update_vsync_parameters_call_count_ = 0; |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(SoftwareBrowserCompositorOutputSurfaceTest); | 93 DISALLOW_COPY_AND_ASSIGN(SoftwareBrowserCompositorOutputSurfaceTest); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { | 96 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { |
| 97 bool enable_pixel_output = false; | 97 bool enable_pixel_output = false; |
| 98 ui::ContextFactory* context_factory = | 98 ui::ContextFactory* context_factory = nullptr; |
| 99 ui::InitializeContextFactoryForTests(enable_pixel_output); | 99 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 100 | 100 |
| 101 compositor_.reset( | 101 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 102 new ui::Compositor(context_factory, message_loop_.task_runner().get())); | 102 &context_factory_private); |
| 103 |
| 104 compositor_.reset(new ui::Compositor(context_factory, context_factory_private, |
| 105 message_loop_.task_runner().get())); |
| 103 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 106 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| 104 } | 107 } |
| 105 | 108 |
| 106 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { | 109 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { |
| 107 output_surface_.reset(); | 110 output_surface_.reset(); |
| 108 compositor_.reset(); | 111 compositor_.reset(); |
| 109 ui::TerminateContextFactoryForTests(); | 112 ui::TerminateContextFactoryForTests(); |
| 110 } | 113 } |
| 111 | 114 |
| 112 std::unique_ptr<content::BrowserCompositorOutputSurface> | 115 std::unique_ptr<content::BrowserCompositorOutputSurface> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 output_surface_->BindToClient(&output_surface_client); | 149 output_surface_->BindToClient(&output_surface_client); |
| 147 | 150 |
| 148 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 151 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
| 149 output_surface_->software_device()->GetVSyncProvider()); | 152 output_surface_->software_device()->GetVSyncProvider()); |
| 150 EXPECT_EQ(0, vsync_provider->call_count()); | 153 EXPECT_EQ(0, vsync_provider->call_count()); |
| 151 | 154 |
| 152 output_surface_->SwapBuffers(cc::OutputSurfaceFrame()); | 155 output_surface_->SwapBuffers(cc::OutputSurfaceFrame()); |
| 153 EXPECT_EQ(1, vsync_provider->call_count()); | 156 EXPECT_EQ(1, vsync_provider->call_count()); |
| 154 EXPECT_EQ(1, update_vsync_parameters_call_count_); | 157 EXPECT_EQ(1, update_vsync_parameters_call_count_); |
| 155 } | 158 } |
| OLD | NEW |