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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 protected: | 349 protected: |
350 void SetUp() override { | 350 void SetUp() override { |
351 provider_ = TestContextProvider::Create(); | 351 provider_ = TestContextProvider::Create(); |
352 output_surface_.reset(new OverlayOutputSurface(provider_)); | 352 output_surface_.reset(new OverlayOutputSurface(provider_)); |
353 EXPECT_TRUE(output_surface_->BindToClient(&client_)); | 353 EXPECT_TRUE(output_surface_->BindToClient(&client_)); |
354 output_surface_->SetOverlayCandidateValidator( | 354 output_surface_->SetOverlayCandidateValidator( |
355 new OverlayCandidateValidatorType); | 355 new OverlayCandidateValidatorType); |
356 | 356 |
357 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 357 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
358 resource_provider_ = FakeResourceProvider::Create( | 358 resource_provider_ = FakeResourceProvider::Create( |
359 output_surface_.get(), shared_bitmap_manager_.get()); | 359 provider_.get(), shared_bitmap_manager_.get()); |
360 | 360 |
361 overlay_processor_.reset(new OverlayProcessor(output_surface_.get())); | 361 overlay_processor_.reset(new OverlayProcessor(output_surface_.get())); |
362 overlay_processor_->Initialize(); | 362 overlay_processor_->Initialize(); |
363 } | 363 } |
364 | 364 |
365 scoped_refptr<TestContextProvider> provider_; | 365 scoped_refptr<TestContextProvider> provider_; |
366 std::unique_ptr<OverlayOutputSurface> output_surface_; | 366 std::unique_ptr<OverlayOutputSurface> output_surface_; |
367 FakeOutputSurfaceClient client_; | 367 FakeOutputSurfaceClient client_; |
368 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; | 368 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
369 std::unique_ptr<ResourceProvider> resource_provider_; | 369 std::unique_ptr<ResourceProvider> resource_provider_; |
(...skipping 18 matching lines...) Expand all Loading... |
388 TEST(OverlayTest, OverlaysProcessorHasStrategy) { | 388 TEST(OverlayTest, OverlaysProcessorHasStrategy) { |
389 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); | 389 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); |
390 OverlayOutputSurface output_surface(provider); | 390 OverlayOutputSurface output_surface(provider); |
391 FakeOutputSurfaceClient client; | 391 FakeOutputSurfaceClient client; |
392 EXPECT_TRUE(output_surface.BindToClient(&client)); | 392 EXPECT_TRUE(output_surface.BindToClient(&client)); |
393 output_surface.SetOverlayCandidateValidator(new SingleOverlayValidator); | 393 output_surface.SetOverlayCandidateValidator(new SingleOverlayValidator); |
394 | 394 |
395 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( | 395 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( |
396 new TestSharedBitmapManager()); | 396 new TestSharedBitmapManager()); |
397 std::unique_ptr<ResourceProvider> resource_provider = | 397 std::unique_ptr<ResourceProvider> resource_provider = |
398 FakeResourceProvider::Create(&output_surface, | 398 FakeResourceProvider::Create(provider.get(), shared_bitmap_manager.get()); |
399 shared_bitmap_manager.get()); | |
400 | 399 |
401 std::unique_ptr<DefaultOverlayProcessor> overlay_processor( | 400 std::unique_ptr<DefaultOverlayProcessor> overlay_processor( |
402 new DefaultOverlayProcessor(&output_surface)); | 401 new DefaultOverlayProcessor(&output_surface)); |
403 overlay_processor->Initialize(); | 402 overlay_processor->Initialize(); |
404 EXPECT_GE(2U, overlay_processor->GetStrategyCount()); | 403 EXPECT_GE(2U, overlay_processor->GetStrategyCount()); |
405 } | 404 } |
406 | 405 |
407 TEST_F(FullscreenOverlayTest, SuccessfulOverlay) { | 406 TEST_F(FullscreenOverlayTest, SuccessfulOverlay) { |
408 std::unique_ptr<RenderPass> pass = CreateRenderPass(); | 407 std::unique_ptr<RenderPass> pass = CreateRenderPass(); |
409 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( | 408 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 const gfx::Rect& display_bounds, | 1303 const gfx::Rect& display_bounds, |
1305 const gfx::RectF& uv_rect)); | 1304 const gfx::RectF& uv_rect)); |
1306 }; | 1305 }; |
1307 | 1306 |
1308 class GLRendererWithOverlaysTest : public testing::Test { | 1307 class GLRendererWithOverlaysTest : public testing::Test { |
1309 protected: | 1308 protected: |
1310 GLRendererWithOverlaysTest() { | 1309 GLRendererWithOverlaysTest() { |
1311 provider_ = TestContextProvider::Create(); | 1310 provider_ = TestContextProvider::Create(); |
1312 output_surface_.reset(new OverlayOutputSurface(provider_)); | 1311 output_surface_.reset(new OverlayOutputSurface(provider_)); |
1313 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 1312 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
1314 resource_provider_ = | 1313 resource_provider_ = FakeResourceProvider::Create(provider_.get(), nullptr); |
1315 FakeResourceProvider::Create(output_surface_.get(), nullptr); | |
1316 | 1314 |
1317 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( | 1315 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( |
1318 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); | 1316 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); |
1319 } | 1317 } |
1320 | 1318 |
1321 void Init(bool use_validator) { | 1319 void Init(bool use_validator) { |
1322 if (use_validator) | 1320 if (use_validator) |
1323 output_surface_->SetOverlayCandidateValidator(new SingleOverlayValidator); | 1321 output_surface_->SetOverlayCandidateValidator(new SingleOverlayValidator); |
1324 | 1322 |
1325 renderer_ = base::MakeUnique<OverlayInfoRendererGL>( | 1323 renderer_ = base::MakeUnique<OverlayInfoRendererGL>( |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 quad_->SetNew(pass_->shared_quad_state_list.back(), kOverlayRect, | 1878 quad_->SetNew(pass_->shared_quad_state_list.back(), kOverlayRect, |
1881 kOverlayRect, render_pass_id_, 0, gfx::Vector2dF(), gfx::Size(), | 1879 kOverlayRect, render_pass_id_, 0, gfx::Vector2dF(), gfx::Size(), |
1882 filters_, gfx::Vector2dF(1, 1), gfx::PointF(), | 1880 filters_, gfx::Vector2dF(1, 1), gfx::PointF(), |
1883 background_filters_); | 1881 background_filters_); |
1884 ProcessForOverlays(); | 1882 ProcessForOverlays(); |
1885 EXPECT_EQ(0U, ca_layer_list_.size()); | 1883 EXPECT_EQ(0U, ca_layer_list_.size()); |
1886 } | 1884 } |
1887 | 1885 |
1888 } // namespace | 1886 } // namespace |
1889 } // namespace cc | 1887 } // namespace cc |
OLD | NEW |