| 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 "cc/base/scoped_ptr_vector.h" | 5 #include "cc/base/scoped_ptr_vector.h" |
| 6 #include "cc/output/gl_renderer.h" | 6 #include "cc/output/gl_renderer.h" |
| 7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
| 8 #include "cc/output/output_surface_client.h" | 8 #include "cc/output/output_surface_client.h" |
| 9 #include "cc/output/overlay_candidate_validator.h" | 9 #include "cc/output/overlay_candidate_validator.h" |
| 10 #include "cc/output/overlay_processor.h" | 10 #include "cc/output/overlay_processor.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 TEST(OverlayTest, OverlaysProcessorHasStrategy) { | 237 TEST(OverlayTest, OverlaysProcessorHasStrategy) { |
| 238 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); | 238 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); |
| 239 OverlayOutputSurface output_surface(provider); | 239 OverlayOutputSurface output_surface(provider); |
| 240 FakeOutputSurfaceClient client; | 240 FakeOutputSurfaceClient client; |
| 241 EXPECT_TRUE(output_surface.BindToClient(&client)); | 241 EXPECT_TRUE(output_surface.BindToClient(&client)); |
| 242 output_surface.InitWithSingleOverlayValidator(); | 242 output_surface.InitWithSingleOverlayValidator(); |
| 243 EXPECT_TRUE(output_surface.overlay_candidate_validator() != NULL); | 243 EXPECT_TRUE(output_surface.overlay_candidate_validator() != NULL); |
| 244 | 244 |
| 245 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 245 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 246 new TestSharedBitmapManager()); | 246 new TestSharedBitmapManager()); |
| 247 scoped_ptr<ResourceProvider> resource_provider( | 247 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 248 ResourceProvider::Create(&output_surface, | 248 &output_surface, shared_bitmap_manager.get(), NULL, NULL, 0, false, 1)); |
| 249 shared_bitmap_manager.get(), | |
| 250 NULL, | |
| 251 NULL, | |
| 252 0, | |
| 253 false, | |
| 254 1, | |
| 255 false)); | |
| 256 | 249 |
| 257 scoped_ptr<DefaultOverlayProcessor> overlay_processor( | 250 scoped_ptr<DefaultOverlayProcessor> overlay_processor( |
| 258 new DefaultOverlayProcessor(&output_surface, resource_provider.get())); | 251 new DefaultOverlayProcessor(&output_surface, resource_provider.get())); |
| 259 overlay_processor->Initialize(); | 252 overlay_processor->Initialize(); |
| 260 EXPECT_GE(1U, overlay_processor->GetStrategyCount()); | 253 EXPECT_GE(1U, overlay_processor->GetStrategyCount()); |
| 261 } | 254 } |
| 262 | 255 |
| 263 class SingleOverlayOnTopTest : public testing::Test { | 256 class SingleOverlayOnTopTest : public testing::Test { |
| 264 protected: | 257 protected: |
| 265 virtual void SetUp() { | 258 virtual void SetUp() { |
| 266 provider_ = TestContextProvider::Create(); | 259 provider_ = TestContextProvider::Create(); |
| 267 output_surface_.reset(new OverlayOutputSurface(provider_)); | 260 output_surface_.reset(new OverlayOutputSurface(provider_)); |
| 268 EXPECT_TRUE(output_surface_->BindToClient(&client_)); | 261 EXPECT_TRUE(output_surface_->BindToClient(&client_)); |
| 269 output_surface_->InitWithSingleOverlayValidator(); | 262 output_surface_->InitWithSingleOverlayValidator(); |
| 270 EXPECT_TRUE(output_surface_->overlay_candidate_validator() != NULL); | 263 EXPECT_TRUE(output_surface_->overlay_candidate_validator() != NULL); |
| 271 | 264 |
| 272 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 265 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 273 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 266 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 274 shared_bitmap_manager_.get(), | 267 shared_bitmap_manager_.get(), |
| 275 NULL, | 268 NULL, |
| 276 NULL, | 269 NULL, |
| 277 0, | 270 0, |
| 278 false, | 271 false, |
| 279 1, | 272 1); |
| 280 false); | |
| 281 | 273 |
| 282 overlay_processor_.reset(new SingleOverlayProcessor( | 274 overlay_processor_.reset(new SingleOverlayProcessor( |
| 283 output_surface_.get(), resource_provider_.get())); | 275 output_surface_.get(), resource_provider_.get())); |
| 284 overlay_processor_->Initialize(); | 276 overlay_processor_->Initialize(); |
| 285 } | 277 } |
| 286 | 278 |
| 287 scoped_refptr<TestContextProvider> provider_; | 279 scoped_refptr<TestContextProvider> provider_; |
| 288 scoped_ptr<OverlayOutputSurface> output_surface_; | 280 scoped_ptr<OverlayOutputSurface> output_surface_; |
| 289 FakeOutputSurfaceClient client_; | 281 FakeOutputSurfaceClient client_; |
| 290 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 282 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 const gfx::RectF& uv_rect)); | 573 const gfx::RectF& uv_rect)); |
| 582 }; | 574 }; |
| 583 | 575 |
| 584 class GLRendererWithOverlaysTest : public testing::Test { | 576 class GLRendererWithOverlaysTest : public testing::Test { |
| 585 protected: | 577 protected: |
| 586 GLRendererWithOverlaysTest() { | 578 GLRendererWithOverlaysTest() { |
| 587 provider_ = TestContextProvider::Create(); | 579 provider_ = TestContextProvider::Create(); |
| 588 output_surface_.reset(new OverlayOutputSurface(provider_)); | 580 output_surface_.reset(new OverlayOutputSurface(provider_)); |
| 589 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 581 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 590 resource_provider_ = ResourceProvider::Create( | 582 resource_provider_ = ResourceProvider::Create( |
| 591 output_surface_.get(), NULL, NULL, NULL, 0, false, 1, false); | 583 output_surface_.get(), NULL, NULL, NULL, 0, false, 1); |
| 592 | 584 |
| 593 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( | 585 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( |
| 594 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); | 586 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); |
| 595 } | 587 } |
| 596 | 588 |
| 597 void Init(bool use_validator) { | 589 void Init(bool use_validator) { |
| 598 if (use_validator) | 590 if (use_validator) |
| 599 output_surface_->InitWithSingleOverlayValidator(); | 591 output_surface_->InitWithSingleOverlayValidator(); |
| 600 | 592 |
| 601 renderer_ = | 593 renderer_ = |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 renderer_->set_expect_overlays(false); | 789 renderer_->set_expect_overlays(false); |
| 798 renderer_->FinishDrawingFrame(&frame3); | 790 renderer_->FinishDrawingFrame(&frame3); |
| 799 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); | 791 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); |
| 800 SwapBuffers(); | 792 SwapBuffers(); |
| 801 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); | 793 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); |
| 802 Mock::VerifyAndClearExpectations(&scheduler_); | 794 Mock::VerifyAndClearExpectations(&scheduler_); |
| 803 } | 795 } |
| 804 | 796 |
| 805 } // namespace | 797 } // namespace |
| 806 } // namespace cc | 798 } // namespace cc |
| OLD | NEW |