OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 | 269 |
270 virtual void AfterTest() OVERRIDE {} | 270 virtual void AfterTest() OVERRIDE {} |
271 | 271 |
272 private: | 272 private: |
273 FakeContentLayerClient client_; | 273 FakeContentLayerClient client_; |
274 scoped_refptr<ContentLayer> root_layer_; | 274 scoped_refptr<ContentLayer> root_layer_; |
275 }; | 275 }; |
276 | 276 |
277 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); | 277 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); |
278 | 278 |
279 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate | |
280 : public LayerTreeHostTest { | |
281 public: | |
282 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate() | |
283 : root_layer_(ContentLayer::Create(&client_)), | |
284 num_draws_(0) {} | |
285 | |
286 virtual void SetupTree() OVERRIDE { | |
287 root_layer_->SetBounds(gfx::Size(10, 20)); | |
288 | |
289 bool paint_scrollbar = true; | |
290 bool has_thumb = false; | |
291 scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar, | |
292 has_thumb, | |
293 root_layer_->id()); | |
294 scrollbar_->SetPosition(gfx::Point(0, 10)); | |
295 scrollbar_->SetBounds(gfx::Size(10, 10)); | |
296 | |
297 root_layer_->AddChild(scrollbar_); | |
298 | |
299 layer_tree_host()->SetRootLayer(root_layer_); | |
300 LayerTreeHostTest::SetupTree(); | |
301 } | |
302 | |
303 virtual void BeginTest() OVERRIDE { | |
304 PostSetNeedsCommitToMainThread(); | |
305 } | |
306 | |
307 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | |
308 num_draws_++; | |
309 if (num_draws_ == 2) | |
310 EndTest(); | |
danakj
2013/04/18 18:53:32
Can you not tie this to the number of draws? You m
ajuma
2013/04/18 18:59:08
I tried this approach, but this wasn't enough to g
ajuma
2013/04/18 19:21:25
As discussed offline, changed this to use source_f
| |
311 } | |
312 | |
313 virtual void DidCommit() OVERRIDE { | |
314 switch (layer_tree_host()->commit_number()) { | |
315 case 1: | |
316 // This should cause a single commit. | |
317 scrollbar_->SetRasterScale(4.0f); | |
318 break; | |
319 default: | |
320 // No extra commits. | |
321 EXPECT_EQ(2, layer_tree_host()->commit_number()); | |
322 } | |
323 } | |
324 | |
325 virtual void AfterTest() OVERRIDE {} | |
326 | |
327 private: | |
328 FakeContentLayerClient client_; | |
329 scoped_refptr<ContentLayer> root_layer_; | |
danakj
2013/04/18 18:53:32
can you use FakeContentLayer instead? it does stuf
ajuma
2013/04/18 19:21:25
Done.
| |
330 scoped_refptr<FakeScrollbarLayer> scrollbar_; | |
331 int num_draws_; | |
332 }; | |
333 | |
334 SINGLE_AND_MULTI_THREAD_TEST_F( | |
335 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); | |
336 | |
279 class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest { | 337 class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest { |
280 public: | 338 public: |
281 LayerTreeHostTestCompositeAndReadback() : num_commits_(0) {} | 339 LayerTreeHostTestCompositeAndReadback() : num_commits_(0) {} |
282 | 340 |
283 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 341 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
284 | 342 |
285 virtual void DidCommit() OVERRIDE { | 343 virtual void DidCommit() OVERRIDE { |
286 num_commits_++; | 344 num_commits_++; |
287 if (num_commits_ == 1) { | 345 if (num_commits_ == 1) { |
288 char pixels[4]; | 346 char pixels[4]; |
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2323 | 2381 |
2324 private: | 2382 private: |
2325 SetBoundsClient client_; | 2383 SetBoundsClient client_; |
2326 int num_commits_; | 2384 int num_commits_; |
2327 }; | 2385 }; |
2328 | 2386 |
2329 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); | 2387 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); |
2330 | 2388 |
2331 } // namespace | 2389 } // namespace |
2332 } // namespace cc | 2390 } // namespace cc |
OLD | NEW |