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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4461 SwapPromise::DidNotSwapReason reason; | 4461 SwapPromise::DidNotSwapReason reason; |
4462 base::Lock lock; | 4462 base::Lock lock; |
4463 }; | 4463 }; |
4464 | 4464 |
4465 class TestSwapPromise : public SwapPromise { | 4465 class TestSwapPromise : public SwapPromise { |
4466 public: | 4466 public: |
4467 explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {} | 4467 explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {} |
4468 | 4468 |
4469 virtual ~TestSwapPromise() { | 4469 virtual ~TestSwapPromise() { |
4470 base::AutoLock lock(result_->lock); | 4470 base::AutoLock lock(result_->lock); |
4471 LOG(INFO) << "~TestSwapPromise() " | |
danakj
2014/08/13 23:09:07
i suggest LOG(ERROR), maybe this works too but i'v
Yufeng Shen (Slow to review)
2014/08/13 23:25:58
Done.
| |
4472 << " did_swap_called " << result_->did_swap_called | |
4473 << " did_not_swap_called " << result_->did_not_swap_called | |
4474 << " result addr " << result_; | |
4471 result_->dtor_called = true; | 4475 result_->dtor_called = true; |
4472 } | 4476 } |
4473 | 4477 |
4474 virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE { | 4478 virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE { |
4475 base::AutoLock lock(result_->lock); | 4479 base::AutoLock lock(result_->lock); |
4480 LOG(INFO) << "TestSwapPromise::DidSwap " | |
4481 << " did_swap_called " << result_->did_swap_called | |
4482 << " did_not_swap_called " << result_->did_not_swap_called | |
4483 << " result addr " << result_; | |
4476 EXPECT_FALSE(result_->did_swap_called); | 4484 EXPECT_FALSE(result_->did_swap_called); |
4477 EXPECT_FALSE(result_->did_not_swap_called); | 4485 EXPECT_FALSE(result_->did_not_swap_called); |
4478 result_->did_swap_called = true; | 4486 result_->did_swap_called = true; |
4479 } | 4487 } |
4480 | 4488 |
4481 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { | 4489 virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE { |
4482 base::AutoLock lock(result_->lock); | 4490 base::AutoLock lock(result_->lock); |
4491 LOG(INFO) << "TestSwapPromise::DidNotSwap " | |
4492 << " reason " << reason | |
4493 << " did_swap_called " << result_->did_swap_called | |
4494 << " did_not_swap_called " << result_->did_not_swap_called | |
4495 << " result addr " << result_; | |
4483 EXPECT_FALSE(result_->did_swap_called); | 4496 EXPECT_FALSE(result_->did_swap_called); |
4484 EXPECT_FALSE(result_->did_not_swap_called); | 4497 EXPECT_FALSE(result_->did_not_swap_called); |
4485 result_->did_not_swap_called = true; | 4498 result_->did_not_swap_called = true; |
4486 result_->reason = reason; | 4499 result_->reason = reason; |
4487 } | 4500 } |
4488 | 4501 |
4489 private: | 4502 private: |
4490 // Not owned. | 4503 // Not owned. |
4491 TestSwapPromiseResult* result_; | 4504 TestSwapPromiseResult* result_; |
4492 }; | 4505 }; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4556 EXPECT_TRUE(swap_promise_result_[2].dtor_called); | 4569 EXPECT_TRUE(swap_promise_result_[2].dtor_called); |
4557 } | 4570 } |
4558 } | 4571 } |
4559 | 4572 |
4560 int commit_count_; | 4573 int commit_count_; |
4561 int commit_complete_count_; | 4574 int commit_complete_count_; |
4562 TestSwapPromiseResult swap_promise_result_[3]; | 4575 TestSwapPromiseResult swap_promise_result_[3]; |
4563 }; | 4576 }; |
4564 | 4577 |
4565 // TODO(miletus): Flaky test: crbug.com/393995 | 4578 // TODO(miletus): Flaky test: crbug.com/393995 |
4566 // MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4579 // Enabled with verbose logging information. |
4580 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | |
4567 | 4581 |
4568 class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit | 4582 class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit |
4569 : public LayerTreeHostTest { | 4583 : public LayerTreeHostTest { |
4570 protected: | 4584 protected: |
4571 LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit() | 4585 LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit() |
4572 : commit_count_(0) {} | 4586 : commit_count_(0) {} |
4573 | 4587 |
4574 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4588 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
4575 | 4589 |
4576 virtual void WillBeginMainFrame() OVERRIDE { | 4590 virtual void WillBeginMainFrame() OVERRIDE { |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5041 const gfx::Size bounds_; | 5055 const gfx::Size bounds_; |
5042 FakeContentLayerClient client_; | 5056 FakeContentLayerClient client_; |
5043 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5057 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5044 scoped_refptr<FakePictureLayer> picture_layer_; | 5058 scoped_refptr<FakePictureLayer> picture_layer_; |
5045 Layer* child_layer_; | 5059 Layer* child_layer_; |
5046 }; | 5060 }; |
5047 | 5061 |
5048 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5062 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5049 | 5063 |
5050 } // namespace cc | 5064 } // namespace cc |
OLD | NEW |