Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: cc/surfaces/surface_factory_unittest.cc

Issue 2642123004: Fix surface reference assumptions in SurfaceManager. (Closed)
Patch Set: Rebase + fix test. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/surfaces/surface_factory.h" 5 #include "cc/surfaces/surface_factory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 495
496 TransferableResource resource; 496 TransferableResource resource;
497 resource.id = 1; 497 resource.id = 1;
498 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; 498 resource.mailbox_holder.texture_target = GL_TEXTURE_2D;
499 CompositorFrame frame; 499 CompositorFrame frame;
500 frame.resource_list.push_back(resource); 500 frame.resource_list.push_back(resource);
501 factory_->SubmitCompositorFrame(id, std::move(frame), 501 factory_->SubmitCompositorFrame(id, std::move(frame),
502 SurfaceFactory::DrawCallback()); 502 SurfaceFactory::DrawCallback());
503 EXPECT_EQ(last_created_surface_id().local_frame_id(), id); 503 EXPECT_EQ(last_created_surface_id().local_frame_id(), id);
504 504
505 manager_.RegisterFrameSinkId(kAnotherArbitraryFrameSinkId);
506
505 SurfaceId surface_id(kArbitraryFrameSinkId, id); 507 SurfaceId surface_id(kArbitraryFrameSinkId, id);
506 manager_.AddSurfaceReference(manager_.GetRootSurfaceId(), surface_id); 508 Surface* surface = manager_.GetSurfaceForId(surface_id);
509 surface->AddDestructionDependency(
510 SurfaceSequence(kAnotherArbitraryFrameSinkId, 4));
507 factory_->Reset(); 511 factory_->Reset();
508 EXPECT_TRUE(client_.returned_resources().empty()); 512 EXPECT_TRUE(client_.returned_resources().empty());
509 manager_.RemoveSurfaceReference(manager_.GetRootSurfaceId(), surface_id); 513
514 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4));
510 EXPECT_TRUE(client_.returned_resources().empty()); 515 EXPECT_TRUE(client_.returned_resources().empty());
511 local_frame_id_ = LocalFrameId(); 516 local_frame_id_ = LocalFrameId();
512 } 517 }
513 518
514 TEST_F(SurfaceFactoryTest, DestroySequence) { 519 TEST_F(SurfaceFactoryTest, DestroySequence) {
515 LocalFrameId local_frame_id2(5, kArbitraryToken); 520 LocalFrameId local_frame_id2(5, kArbitraryToken);
516 std::unique_ptr<SurfaceFactory> factory2( 521 std::unique_ptr<SurfaceFactory> factory2(
517 new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_)); 522 new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_));
518 SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2); 523 SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2);
519 factory2->SubmitCompositorFrame(local_frame_id2, CompositorFrame(), 524 factory2->SubmitCompositorFrame(local_frame_id2, CompositorFrame(),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), 694 factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
690 SurfaceFactory::DrawCallback()); 695 SurfaceFactory::DrawCallback());
691 SurfaceId expected_surface_id(factory_->frame_sink_id(), local_frame_id_); 696 SurfaceId expected_surface_id(factory_->frame_sink_id(), local_frame_id_);
692 EXPECT_EQ(expected_surface_id, last_surface_info_.id()); 697 EXPECT_EQ(expected_surface_id, last_surface_info_.id());
693 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor()); 698 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor());
694 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels()); 699 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels());
695 } 700 }
696 701
697 } // namespace 702 } // namespace
698 } // namespace cc 703 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698