| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // |message_loop_| is not used, but the main thread still has to exist for the | 83 // |message_loop_| is not used, but the main thread still has to exist for the |
| 84 // compositor to use. | 84 // compositor to use. |
| 85 message_loop_.reset(new base::MessageLoopForUI); | 85 message_loop_.reset(new base::MessageLoopForUI); |
| 86 } | 86 } |
| 87 | 87 |
| 88 SoftwareBrowserCompositorOutputSurfaceTest:: | 88 SoftwareBrowserCompositorOutputSurfaceTest:: |
| 89 ~SoftwareBrowserCompositorOutputSurfaceTest() {} | 89 ~SoftwareBrowserCompositorOutputSurfaceTest() {} |
| 90 | 90 |
| 91 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { | 91 void SoftwareBrowserCompositorOutputSurfaceTest::SetUp() { |
| 92 bool enable_pixel_output = false; | 92 bool enable_pixel_output = false; |
| 93 ui::InitializeContextFactoryForTests(enable_pixel_output); | 93 ui::ContextFactory* context_factory = |
| 94 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 94 | 95 |
| 95 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget)); | 96 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, |
| 97 context_factory)); |
| 96 surface_proxy_ = | 98 surface_proxy_ = |
| 97 new content::BrowserCompositorOutputSurfaceProxy(&surface_map_); | 99 new content::BrowserCompositorOutputSurfaceProxy(&surface_map_); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { | 102 void SoftwareBrowserCompositorOutputSurfaceTest::TearDown() { |
| 101 output_surface_.reset(); | 103 output_surface_.reset(); |
| 102 compositor_.reset(); | 104 compositor_.reset(); |
| 103 | 105 |
| 104 EXPECT_TRUE(surface_map_.IsEmpty()); | 106 EXPECT_TRUE(surface_map_.IsEmpty()); |
| 105 | 107 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 139 |
| 138 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( | 140 FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( |
| 139 output_surface_->software_device()->GetVSyncProvider()); | 141 output_surface_->software_device()->GetVSyncProvider()); |
| 140 EXPECT_EQ(0, vsync_provider->call_count()); | 142 EXPECT_EQ(0, vsync_provider->call_count()); |
| 141 | 143 |
| 142 cc::CompositorFrame frame; | 144 cc::CompositorFrame frame; |
| 143 output_surface_->SwapBuffers(&frame); | 145 output_surface_->SwapBuffers(&frame); |
| 144 | 146 |
| 145 EXPECT_EQ(1, vsync_provider->call_count()); | 147 EXPECT_EQ(1, vsync_provider->call_count()); |
| 146 } | 148 } |
| OLD | NEW |