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

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: 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 unified diff | Download patch
« no previous file with comments | « cc/layers/surface_layer_impl_unittest.cc ('k') | cc/surfaces/direct_compositor_frame_sink.cc » ('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 <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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 scoped_refptr<SurfaceLayer> layer2(SurfaceLayer::Create( 89 scoped_refptr<SurfaceLayer> layer2(SurfaceLayer::Create(
90 base::Bind(&SatisfyCallback, &blank_change), 90 base::Bind(&SatisfyCallback, &blank_change),
91 base::Bind(&RequireCallback, &required_id, &required_seq))); 91 base::Bind(&RequireCallback, &required_id, &required_seq)));
92 layer2->SetSurfaceId(SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)), 92 layer2->SetSurfaceId(SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)),
93 1.f, gfx::Size(1, 1)); 93 1.f, gfx::Size(1, 1));
94 layer_tree_host2->GetSurfaceSequenceGenerator()->set_frame_sink_id( 94 layer_tree_host2->GetSurfaceSequenceGenerator()->set_frame_sink_id(
95 FrameSinkId(2, 2)); 95 FrameSinkId(2, 2));
96 layer_tree_host2->SetRootLayer(layer2); 96 layer_tree_host2->SetRootLayer(layer2);
97 97
98 // Layers haven't been removed, so no sequence should be satisfied. 98 // Layers haven't been removed, so no sequence should be satisfied.
99 EXPECT_TRUE(blank_change.is_null()); 99 EXPECT_FALSE(blank_change.is_valid());
100 100
101 SurfaceSequence expected1(FrameSinkId(1, 1), 1u); 101 SurfaceSequence expected1(FrameSinkId(1, 1), 1u);
102 SurfaceSequence expected2(FrameSinkId(2, 2), 1u); 102 SurfaceSequence expected2(FrameSinkId(2, 2), 1u);
103 103
104 layer_tree_host2->SetRootLayer(nullptr); 104 layer_tree_host2->SetRootLayer(nullptr);
105 layer_tree_host2.reset(); 105 layer_tree_host2.reset();
106 animation_host2 = nullptr; 106 animation_host2 = nullptr;
107 107
108 // Layer was removed so sequence from second LayerTreeHost should be 108 // Layer was removed so sequence from second LayerTreeHost should be
109 // satisfied. 109 // satisfied.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 EndTest(); 217 EndTest();
218 } 218 }
219 } 219 }
220 220
221 void AfterTest() override { 221 void AfterTest() override {
222 EXPECT_TRUE(required_id_ == 222 EXPECT_TRUE(required_id_ ==
223 SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0))); 223 SurfaceId(kArbitraryFrameSinkId, LocalFrameId(1, 0)));
224 EXPECT_EQ(1u, required_set_.size()); 224 EXPECT_EQ(1u, required_set_.size());
225 // Sequence should have been satisfied through Swap, not with the 225 // Sequence should have been satisfied through Swap, not with the
226 // callback. 226 // callback.
227 EXPECT_TRUE(satisfied_sequence_.is_null()); 227 EXPECT_FALSE(satisfied_sequence_.is_valid());
228 } 228 }
229 }; 229 };
230 230
231 SINGLE_AND_MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithDraw); 231 SINGLE_AND_MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithDraw);
232 232
233 // Check that SurfaceSequence is sent through swap promise and resolved when 233 // Check that SurfaceSequence is sent through swap promise and resolved when
234 // swap fails. 234 // swap fails.
235 class SurfaceLayerSwapPromiseWithoutDraw : public SurfaceLayerSwapPromise { 235 class SurfaceLayerSwapPromiseWithoutDraw : public SurfaceLayerSwapPromise {
236 public: 236 public:
237 SurfaceLayerSwapPromiseWithoutDraw() : SurfaceLayerSwapPromise() {} 237 SurfaceLayerSwapPromiseWithoutDraw() : SurfaceLayerSwapPromise() {}
(...skipping 27 matching lines...) Expand all
265 // Sequence should have been satisfied with the callback. 265 // Sequence should have been satisfied with the callback.
266 EXPECT_TRUE(satisfied_sequence_ == 266 EXPECT_TRUE(satisfied_sequence_ ==
267 SurfaceSequence(kArbitraryFrameSinkId, 1u)); 267 SurfaceSequence(kArbitraryFrameSinkId, 1u));
268 } 268 }
269 }; 269 };
270 270
271 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); 271 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw);
272 272
273 } // namespace 273 } // namespace
274 } // namespace cc 274 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/surface_layer_impl_unittest.cc ('k') | cc/surfaces/direct_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698