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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 TEST(OverlayTest, OverlaysProcessorHasStrategy) { | 239 TEST(OverlayTest, OverlaysProcessorHasStrategy) { |
240 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); | 240 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); |
241 OverlayOutputSurface output_surface(provider); | 241 OverlayOutputSurface output_surface(provider); |
242 FakeOutputSurfaceClient client; | 242 FakeOutputSurfaceClient client; |
243 EXPECT_TRUE(output_surface.BindToClient(&client)); | 243 EXPECT_TRUE(output_surface.BindToClient(&client)); |
244 output_surface.InitWithSingleOverlayValidator(); | 244 output_surface.InitWithSingleOverlayValidator(); |
245 EXPECT_TRUE(output_surface.overlay_candidate_validator() != NULL); | 245 EXPECT_TRUE(output_surface.overlay_candidate_validator() != NULL); |
246 | 246 |
247 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 247 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
248 new TestSharedBitmapManager()); | 248 new TestSharedBitmapManager()); |
249 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 249 scoped_ptr<ResourceProvider> resource_provider( |
250 &output_surface, shared_bitmap_manager.get(), NULL, NULL, 0, false, 1)); | 250 ResourceProvider::Create(&output_surface, shared_bitmap_manager.get(), |
| 251 NULL, NULL, 0, false, false, 1)); |
251 | 252 |
252 scoped_ptr<DefaultOverlayProcessor> overlay_processor( | 253 scoped_ptr<DefaultOverlayProcessor> overlay_processor( |
253 new DefaultOverlayProcessor(&output_surface, resource_provider.get())); | 254 new DefaultOverlayProcessor(&output_surface, resource_provider.get())); |
254 overlay_processor->Initialize(); | 255 overlay_processor->Initialize(); |
255 EXPECT_GE(1U, overlay_processor->GetStrategyCount()); | 256 EXPECT_GE(1U, overlay_processor->GetStrategyCount()); |
256 } | 257 } |
257 | 258 |
258 class SingleOverlayOnTopTest : public testing::Test { | 259 class SingleOverlayOnTopTest : public testing::Test { |
259 protected: | 260 protected: |
260 virtual void SetUp() { | 261 virtual void SetUp() { |
261 provider_ = TestContextProvider::Create(); | 262 provider_ = TestContextProvider::Create(); |
262 output_surface_.reset(new OverlayOutputSurface(provider_)); | 263 output_surface_.reset(new OverlayOutputSurface(provider_)); |
263 EXPECT_TRUE(output_surface_->BindToClient(&client_)); | 264 EXPECT_TRUE(output_surface_->BindToClient(&client_)); |
264 output_surface_->InitWithSingleOverlayValidator(); | 265 output_surface_->InitWithSingleOverlayValidator(); |
265 EXPECT_TRUE(output_surface_->overlay_candidate_validator() != NULL); | 266 EXPECT_TRUE(output_surface_->overlay_candidate_validator() != NULL); |
266 | 267 |
267 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 268 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
268 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 269 resource_provider_ = ResourceProvider::Create( |
269 shared_bitmap_manager_.get(), | 270 output_surface_.get(), shared_bitmap_manager_.get(), NULL, NULL, 0, |
270 NULL, | 271 false, false, 1); |
271 NULL, | |
272 0, | |
273 false, | |
274 1); | |
275 | 272 |
276 overlay_processor_.reset(new SingleOverlayProcessor( | 273 overlay_processor_.reset(new SingleOverlayProcessor( |
277 output_surface_.get(), resource_provider_.get())); | 274 output_surface_.get(), resource_provider_.get())); |
278 overlay_processor_->Initialize(); | 275 overlay_processor_->Initialize(); |
279 } | 276 } |
280 | 277 |
281 scoped_refptr<TestContextProvider> provider_; | 278 scoped_refptr<TestContextProvider> provider_; |
282 scoped_ptr<OverlayOutputSurface> output_surface_; | 279 scoped_ptr<OverlayOutputSurface> output_surface_; |
283 FakeOutputSurfaceClient client_; | 280 FakeOutputSurfaceClient client_; |
284 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 281 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 const gfx::RectF& uv_rect)); | 574 const gfx::RectF& uv_rect)); |
578 }; | 575 }; |
579 | 576 |
580 class GLRendererWithOverlaysTest : public testing::Test { | 577 class GLRendererWithOverlaysTest : public testing::Test { |
581 protected: | 578 protected: |
582 GLRendererWithOverlaysTest() { | 579 GLRendererWithOverlaysTest() { |
583 provider_ = TestContextProvider::Create(); | 580 provider_ = TestContextProvider::Create(); |
584 output_surface_.reset(new OverlayOutputSurface(provider_)); | 581 output_surface_.reset(new OverlayOutputSurface(provider_)); |
585 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 582 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
586 resource_provider_ = ResourceProvider::Create( | 583 resource_provider_ = ResourceProvider::Create( |
587 output_surface_.get(), NULL, NULL, NULL, 0, false, 1); | 584 output_surface_.get(), NULL, NULL, NULL, 0, false, false, 1); |
588 | 585 |
589 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( | 586 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( |
590 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); | 587 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); |
591 } | 588 } |
592 | 589 |
593 void Init(bool use_validator) { | 590 void Init(bool use_validator) { |
594 if (use_validator) | 591 if (use_validator) |
595 output_surface_->InitWithSingleOverlayValidator(); | 592 output_surface_->InitWithSingleOverlayValidator(); |
596 | 593 |
597 renderer_ = | 594 renderer_ = |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 renderer_->BeginDrawingFrame(&frame3); | 804 renderer_->BeginDrawingFrame(&frame3); |
808 renderer_->FinishDrawingFrame(&frame3); | 805 renderer_->FinishDrawingFrame(&frame3); |
809 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); | 806 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); |
810 SwapBuffers(); | 807 SwapBuffers(); |
811 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); | 808 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); |
812 Mock::VerifyAndClearExpectations(&scheduler_); | 809 Mock::VerifyAndClearExpectations(&scheduler_); |
813 } | 810 } |
814 | 811 |
815 } // namespace | 812 } // namespace |
816 } // namespace cc | 813 } // namespace cc |
OLD | NEW |