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

Unified Diff: cc/surfaces/surface_factory_unittest.cc

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/surface_aggregator_unittest.cc ('k') | cc/surfaces/surface_id.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory_unittest.cc
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index 2f917d7853923e68907bc27af5c31fddf2ef54a7..6592fcbfbb3035d2c69a20ae44aed309308a4e76 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -26,6 +26,7 @@ namespace cc {
namespace {
static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
+static constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2);
class TestSurfaceFactoryClient : public SurfaceFactoryClient {
public:
@@ -68,7 +69,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceObserver {
SurfaceFactoryTest()
: factory_(
new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_)),
- local_frame_id_(3, 0),
+ local_frame_id_(3, 1),
frame_sync_token_(GenTestSyncToken(4)),
consumer_sync_token_(GenTestSyncToken(5)) {
manager_.AddObserver(this);
@@ -92,7 +93,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceObserver {
}
~SurfaceFactoryTest() override {
- if (!local_frame_id_.is_null())
+ if (local_frame_id_.is_valid())
factory_->Destroy(local_frame_id_);
manager_.RemoveObserver(this);
}
@@ -432,7 +433,7 @@ TEST_F(SurfaceFactoryTest, ResourceLifetime) {
}
TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) {
- LocalFrameId local_frame_id(6, 0);
+ LocalFrameId local_frame_id(6, 1);
SurfaceId surface_id(kArbitraryFrameSinkId, local_frame_id);
factory_->Create(local_frame_id);
Surface* surface = manager_.GetSurfaceForId(surface_id);
@@ -455,7 +456,7 @@ void CreateSurfaceDrawCallback(SurfaceFactory* factory,
}
TEST_F(SurfaceFactoryTest, AddDuringDestroy) {
- LocalFrameId local_frame_id(6, 0);
+ LocalFrameId local_frame_id(6, 1);
factory_->Create(local_frame_id);
uint32_t execute_count = 0;
@@ -474,7 +475,7 @@ void DrawCallback(uint32_t* execute_count) {
// Tests doing a DestroyAll before shutting down the factory;
TEST_F(SurfaceFactoryTest, DestroyAll) {
- LocalFrameId id(7, 0);
+ LocalFrameId id(7, 1);
factory_->Create(id);
TransferableResource resource;
@@ -516,7 +517,7 @@ TEST_F(SurfaceFactoryTest, Reset) {
}
TEST_F(SurfaceFactoryTest, DestroySequence) {
- LocalFrameId local_frame_id2(5, 0);
+ LocalFrameId local_frame_id2(5, 1);
SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2);
factory_->Create(local_frame_id2);
@@ -540,7 +541,7 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
factory_->Create(local_frame_id2);
DCHECK(manager_.GetSurfaceForId(id2));
manager_.GetSurfaceForId(id2)->AddDestructionDependency(
- SurfaceSequence(FrameSinkId(0, 0), 6));
+ SurfaceSequence(kAnotherArbitraryFrameSinkId, 6));
factory_->Destroy(local_frame_id2);
DCHECK(!manager_.GetSurfaceForId(id2));
}
@@ -550,7 +551,7 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
TEST_F(SurfaceFactoryTest, InvalidFrameSinkId) {
FrameSinkId frame_sink_id(1234, 5678);
- LocalFrameId local_frame_id(5, 0);
+ LocalFrameId local_frame_id(5, 1);
SurfaceId id(factory_->frame_sink_id(), local_frame_id);
factory_->Create(local_frame_id);
@@ -570,14 +571,14 @@ TEST_F(SurfaceFactoryTest, InvalidFrameSinkId) {
}
TEST_F(SurfaceFactoryTest, DestroyCycle) {
- LocalFrameId local_frame_id2(5, 0);
+ LocalFrameId local_frame_id2(5, 1);
SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2);
factory_->Create(local_frame_id2);
- manager_.RegisterFrameSinkId(FrameSinkId(0, 0));
+ manager_.RegisterFrameSinkId(kAnotherArbitraryFrameSinkId);
manager_.GetSurfaceForId(id2)->AddDestructionDependency(
- SurfaceSequence(FrameSinkId(0, 0), 4));
+ SurfaceSequence(kAnotherArbitraryFrameSinkId, 4));
// Give id2 a frame that references local_frame_id_.
{
@@ -611,7 +612,7 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) {
// Satisfy last destruction dependency for id2.
std::vector<uint32_t> to_satisfy;
to_satisfy.push_back(4);
- manager_.DidSatisfySequences(FrameSinkId(0, 0), &to_satisfy);
+ manager_.DidSatisfySequences(kAnotherArbitraryFrameSinkId, &to_satisfy);
// id2 and local_frame_id_ are in a reference cycle that has no surface
// sequences holding on to it, so they should be destroyed.
« no previous file with comments | « cc/surfaces/surface_aggregator_unittest.cc ('k') | cc/surfaces/surface_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698