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

Side by Side Diff: cc/layers/surface_layer_unittest.cc

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. Created 4 years, 2 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
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 scoped_refptr<SurfaceLayer> layer2(SurfaceLayer::Create( 84 scoped_refptr<SurfaceLayer> layer2(SurfaceLayer::Create(
85 base::Bind(&SatisfyCallback, &blank_change), 85 base::Bind(&SatisfyCallback, &blank_change),
86 base::Bind(&RequireCallback, &required_id, &required_seq))); 86 base::Bind(&RequireCallback, &required_id, &required_seq)));
87 layer2->SetSurfaceId(SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)), 87 layer2->SetSurfaceId(SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)),
88 1.f, gfx::Size(1, 1)); 88 1.f, gfx::Size(1, 1));
89 layer_tree_host2->GetSurfaceSequenceGenerator()->set_frame_sink_id( 89 layer_tree_host2->GetSurfaceSequenceGenerator()->set_frame_sink_id(
90 FrameSinkId(2, 2)); 90 FrameSinkId(2, 2));
91 layer_tree_host2->SetRootLayer(layer2); 91 layer_tree_host2->SetRootLayer(layer2);
92 92
93 // Layers haven't been removed, so no sequence should be satisfied. 93 // Layers haven't been removed, so no sequence should be satisfied.
94 EXPECT_TRUE(blank_change.is_null()); 94 EXPECT_FALSE(blank_change.is_valid());
95 95
96 SurfaceSequence expected1(FrameSinkId(1, 1), 1u); 96 SurfaceSequence expected1(FrameSinkId(1, 1), 1u);
97 SurfaceSequence expected2(FrameSinkId(2, 2), 1u); 97 SurfaceSequence expected2(FrameSinkId(2, 2), 1u);
98 98
99 layer_tree_host2->SetRootLayer(nullptr); 99 layer_tree_host2->SetRootLayer(nullptr);
100 layer_tree_host2.reset(); 100 layer_tree_host2.reset();
101 101
102 // Layer was removed so sequence from second LayerTreeHost should be 102 // Layer was removed so sequence from second LayerTreeHost should be
103 // satisfied. 103 // satisfied.
104 EXPECT_TRUE(blank_change == expected2); 104 EXPECT_TRUE(blank_change == expected2);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 EndTest(); 211 EndTest();
212 } 212 }
213 } 213 }
214 214
215 void AfterTest() override { 215 void AfterTest() override {
216 EXPECT_TRUE(required_id_ == 216 EXPECT_TRUE(required_id_ ==
217 SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0))); 217 SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)));
218 EXPECT_EQ(1u, required_set_.size()); 218 EXPECT_EQ(1u, required_set_.size());
219 // Sequence should have been satisfied through Swap, not with the 219 // Sequence should have been satisfied through Swap, not with the
220 // callback. 220 // callback.
221 EXPECT_TRUE(satisfied_sequence_.is_null()); 221 EXPECT_FALSE(satisfied_sequence_.is_valid());
222 } 222 }
223 }; 223 };
224 224
225 SINGLE_AND_MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithDraw); 225 SINGLE_AND_MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithDraw);
226 226
227 // Check that SurfaceSequence is sent through swap promise and resolved when 227 // Check that SurfaceSequence is sent through swap promise and resolved when
228 // swap fails. 228 // swap fails.
229 class SurfaceLayerSwapPromiseWithoutDraw : public SurfaceLayerSwapPromise { 229 class SurfaceLayerSwapPromiseWithoutDraw : public SurfaceLayerSwapPromise {
230 public: 230 public:
231 SurfaceLayerSwapPromiseWithoutDraw() : SurfaceLayerSwapPromise() {} 231 SurfaceLayerSwapPromiseWithoutDraw() : SurfaceLayerSwapPromise() {}
(...skipping 27 matching lines...) Expand all
259 // Sequence should have been satisfied with the callback. 259 // Sequence should have been satisfied with the callback.
260 EXPECT_TRUE(satisfied_sequence_ == 260 EXPECT_TRUE(satisfied_sequence_ ==
261 SurfaceSequence(kArbitraryFrameSinkId, 1u)); 261 SurfaceSequence(kArbitraryFrameSinkId, 1u));
262 } 262 }
263 }; 263 };
264 264
265 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); 265 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw);
266 266
267 } // namespace 267 } // namespace
268 } // namespace cc 268 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698