| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 void InitializeSettings(LayerTreeSettings* settings) override { | 386 void InitializeSettings(LayerTreeSettings* settings) override { |
| 387 settings->single_thread_proxy_scheduler = false; | 387 settings->single_thread_proxy_scheduler = false; |
| 388 } | 388 } |
| 389 | 389 |
| 390 void RequestNewOutputSurface() override { | 390 void RequestNewOutputSurface() override { |
| 391 EXPECT_GE(1, ++request_count_); | 391 EXPECT_GE(1, ++request_count_); |
| 392 EndTest(); | 392 EndTest(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void BeginTest() override { | 395 void BeginTest() override { |
| 396 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 396 layer_tree_host()->Composite(base::TimeTicks()); |
| 397 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 397 layer_tree_host()->Composite(base::TimeTicks()); |
| 398 } | 398 } |
| 399 | 399 |
| 400 scoped_ptr<OutputSurface> CreateOutputSurface() override { | 400 scoped_ptr<OutputSurface> CreateOutputSurface() override { |
| 401 EXPECT_TRUE(false); | 401 EXPECT_TRUE(false); |
| 402 return nullptr; | 402 return nullptr; |
| 403 } | 403 } |
| 404 | 404 |
| 405 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 405 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 406 | 406 |
| 407 void AfterTest() override {} | 407 void AfterTest() override {} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 432 EXPECT_LE(num_requests_, 2); | 432 EXPECT_LE(num_requests_, 2); |
| 433 if (num_requests_ > 1) | 433 if (num_requests_ > 1) |
| 434 return; | 434 return; |
| 435 ExpectCreateToFail(); | 435 ExpectCreateToFail(); |
| 436 layer_tree_host()->SetOutputSurface( | 436 layer_tree_host()->SetOutputSurface( |
| 437 make_scoped_ptr(new FailureOutputSurface(false))); | 437 make_scoped_ptr(new FailureOutputSurface(false))); |
| 438 } | 438 } |
| 439 | 439 |
| 440 void BeginTest() override { | 440 void BeginTest() override { |
| 441 // First composite tries to create a surface. | 441 // First composite tries to create a surface. |
| 442 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 442 layer_tree_host()->Composite(base::TimeTicks()); |
| 443 EXPECT_EQ(num_requests_, 2); | 443 EXPECT_EQ(num_requests_, 2); |
| 444 EXPECT_TRUE(has_failed_); | 444 EXPECT_TRUE(has_failed_); |
| 445 | 445 |
| 446 // Second composite should not request or fail. | 446 // Second composite should not request or fail. |
| 447 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 447 layer_tree_host()->Composite(base::TimeTicks()); |
| 448 EXPECT_EQ(num_requests_, 2); | 448 EXPECT_EQ(num_requests_, 2); |
| 449 EndTest(); | 449 EndTest(); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 452 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 453 | 453 |
| 454 void DidFailToInitializeOutputSurface() override { | 454 void DidFailToInitializeOutputSurface() override { |
| 455 LayerTreeHostContextTest::DidFailToInitializeOutputSurface(); | 455 LayerTreeHostContextTest::DidFailToInitializeOutputSurface(); |
| 456 EXPECT_FALSE(has_failed_); | 456 EXPECT_FALSE(has_failed_); |
| 457 has_failed_ = true; | 457 has_failed_ = true; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 482 CreateAndSetOutputSurface, | 482 CreateAndSetOutputSurface, |
| 483 base::Unretained(this))); | 483 base::Unretained(this))); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void CreateAndSetOutputSurface() { | 486 void CreateAndSetOutputSurface() { |
| 487 creating_output_ = true; | 487 creating_output_ = true; |
| 488 layer_tree_host()->SetOutputSurface( | 488 layer_tree_host()->SetOutputSurface( |
| 489 LayerTreeHostContextTest::CreateOutputSurface()); | 489 LayerTreeHostContextTest::CreateOutputSurface()); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void BeginTest() override { | 492 void BeginTest() override { layer_tree_host()->Composite(base::TimeTicks()); } |
| 493 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | |
| 494 } | |
| 495 | 493 |
| 496 void ScheduleComposite() override { | 494 void ScheduleComposite() override { |
| 497 if (creating_output_) | 495 if (creating_output_) |
| 498 EndTest(); | 496 EndTest(); |
| 499 } | 497 } |
| 500 | 498 |
| 501 void AfterTest() override {} | 499 void AfterTest() override {} |
| 502 | 500 |
| 503 bool creating_output_; | 501 bool creating_output_; |
| 504 }; | 502 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 517 } | 515 } |
| 518 | 516 |
| 519 void RequestNewOutputSurface() override { | 517 void RequestNewOutputSurface() override { |
| 520 layer_tree_host()->SetOutputSurface( | 518 layer_tree_host()->SetOutputSurface( |
| 521 LayerTreeHostContextTest::CreateOutputSurface()); | 519 LayerTreeHostContextTest::CreateOutputSurface()); |
| 522 EndTest(); | 520 EndTest(); |
| 523 } | 521 } |
| 524 | 522 |
| 525 void BeginTest() override { | 523 void BeginTest() override { |
| 526 in_composite_ = true; | 524 in_composite_ = true; |
| 527 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 525 layer_tree_host()->Composite(base::TimeTicks()); |
| 528 in_composite_ = false; | 526 in_composite_ = false; |
| 529 } | 527 } |
| 530 | 528 |
| 531 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } | 529 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } |
| 532 | 530 |
| 533 void AfterTest() override {} | 531 void AfterTest() override {} |
| 534 | 532 |
| 535 bool in_composite_; | 533 bool in_composite_; |
| 536 }; | 534 }; |
| 537 | 535 |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 void AfterTest() override {} | 1790 void AfterTest() override {} |
| 1793 | 1791 |
| 1794 bool deferred_; | 1792 bool deferred_; |
| 1795 }; | 1793 }; |
| 1796 | 1794 |
| 1797 SINGLE_AND_MULTI_THREAD_TEST_F( | 1795 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1798 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1796 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1799 | 1797 |
| 1800 } // namespace | 1798 } // namespace |
| 1801 } // namespace cc | 1799 } // namespace cc |
| OLD | NEW |