| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
| 10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 settings->single_thread_proxy_scheduler = false; | 388 settings->single_thread_proxy_scheduler = false; |
| 389 settings->use_zero_copy = true; | 389 settings->use_zero_copy = true; |
| 390 } | 390 } |
| 391 | 391 |
| 392 void RequestNewOutputSurface() override { | 392 void RequestNewOutputSurface() override { |
| 393 EXPECT_GE(1, ++request_count_); | 393 EXPECT_GE(1, ++request_count_); |
| 394 EndTest(); | 394 EndTest(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void BeginTest() override { | 397 void BeginTest() override { |
| 398 layer_tree_host()->Composite(base::TimeTicks()); | 398 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 399 layer_tree_host()->Composite(base::TimeTicks()); | 399 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 scoped_ptr<OutputSurface> CreateOutputSurface() override { | 402 scoped_ptr<OutputSurface> CreateOutputSurface() override { |
| 403 EXPECT_TRUE(false); | 403 EXPECT_TRUE(false); |
| 404 return nullptr; | 404 return nullptr; |
| 405 } | 405 } |
| 406 | 406 |
| 407 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 407 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 408 | 408 |
| 409 void AfterTest() override {} | 409 void AfterTest() override {} |
| (...skipping 25 matching lines...) Expand all Loading... |
| 435 EXPECT_LE(num_requests_, 2); | 435 EXPECT_LE(num_requests_, 2); |
| 436 if (num_requests_ > 1) | 436 if (num_requests_ > 1) |
| 437 return; | 437 return; |
| 438 ExpectCreateToFail(); | 438 ExpectCreateToFail(); |
| 439 layer_tree_host()->SetOutputSurface( | 439 layer_tree_host()->SetOutputSurface( |
| 440 make_scoped_ptr(new FailureOutputSurface(false))); | 440 make_scoped_ptr(new FailureOutputSurface(false))); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void BeginTest() override { | 443 void BeginTest() override { |
| 444 // First composite tries to create a surface. | 444 // First composite tries to create a surface. |
| 445 layer_tree_host()->Composite(base::TimeTicks()); | 445 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 446 EXPECT_EQ(num_requests_, 2); | 446 EXPECT_EQ(num_requests_, 2); |
| 447 EXPECT_TRUE(has_failed_); | 447 EXPECT_TRUE(has_failed_); |
| 448 | 448 |
| 449 // Second composite should not request or fail. | 449 // Second composite should not request or fail. |
| 450 layer_tree_host()->Composite(base::TimeTicks()); | 450 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
| 451 EXPECT_EQ(num_requests_, 2); | 451 EXPECT_EQ(num_requests_, 2); |
| 452 EndTest(); | 452 EndTest(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 455 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 456 | 456 |
| 457 void DidFailToInitializeOutputSurface() override { | 457 void DidFailToInitializeOutputSurface() override { |
| 458 LayerTreeHostContextTest::DidFailToInitializeOutputSurface(); | 458 LayerTreeHostContextTest::DidFailToInitializeOutputSurface(); |
| 459 EXPECT_FALSE(has_failed_); | 459 EXPECT_FALSE(has_failed_); |
| 460 has_failed_ = true; | 460 has_failed_ = true; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 486 CreateAndSetOutputSurface, | 486 CreateAndSetOutputSurface, |
| 487 base::Unretained(this))); | 487 base::Unretained(this))); |
| 488 } | 488 } |
| 489 | 489 |
| 490 void CreateAndSetOutputSurface() { | 490 void CreateAndSetOutputSurface() { |
| 491 creating_output_ = true; | 491 creating_output_ = true; |
| 492 layer_tree_host()->SetOutputSurface( | 492 layer_tree_host()->SetOutputSurface( |
| 493 LayerTreeHostContextTest::CreateOutputSurface()); | 493 LayerTreeHostContextTest::CreateOutputSurface()); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void BeginTest() override { layer_tree_host()->Composite(base::TimeTicks()); } | 496 void BeginTest() override { |
| 497 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 498 } |
| 497 | 499 |
| 498 void ScheduleComposite() override { | 500 void ScheduleComposite() override { |
| 499 if (creating_output_) | 501 if (creating_output_) |
| 500 EndTest(); | 502 EndTest(); |
| 501 } | 503 } |
| 502 | 504 |
| 503 void AfterTest() override {} | 505 void AfterTest() override {} |
| 504 | 506 |
| 505 bool creating_output_; | 507 bool creating_output_; |
| 506 }; | 508 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 520 } | 522 } |
| 521 | 523 |
| 522 void RequestNewOutputSurface() override { | 524 void RequestNewOutputSurface() override { |
| 523 layer_tree_host()->SetOutputSurface( | 525 layer_tree_host()->SetOutputSurface( |
| 524 LayerTreeHostContextTest::CreateOutputSurface()); | 526 LayerTreeHostContextTest::CreateOutputSurface()); |
| 525 EndTest(); | 527 EndTest(); |
| 526 } | 528 } |
| 527 | 529 |
| 528 void BeginTest() override { | 530 void BeginTest() override { |
| 529 in_composite_ = true; | 531 in_composite_ = true; |
| 530 layer_tree_host()->Composite(base::TimeTicks()); | 532 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 531 in_composite_ = false; | 533 in_composite_ = false; |
| 532 } | 534 } |
| 533 | 535 |
| 534 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } | 536 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } |
| 535 | 537 |
| 536 void AfterTest() override {} | 538 void AfterTest() override {} |
| 537 | 539 |
| 538 bool in_composite_; | 540 bool in_composite_; |
| 539 }; | 541 }; |
| 540 | 542 |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 void AfterTest() override {} | 1805 void AfterTest() override {} |
| 1804 | 1806 |
| 1805 bool deferred_; | 1807 bool deferred_; |
| 1806 }; | 1808 }; |
| 1807 | 1809 |
| 1808 SINGLE_AND_MULTI_THREAD_TEST_F( | 1810 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1809 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1811 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1810 | 1812 |
| 1811 } // namespace | 1813 } // namespace |
| 1812 } // namespace cc | 1814 } // namespace cc |
| OLD | NEW |