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/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 518 } |
519 | 519 |
520 void LayerTreeTest::RunTest(bool threaded) { | 520 void LayerTreeTest::RunTest(bool threaded) { |
521 if (threaded) { | 521 if (threaded) { |
522 impl_thread_.reset(new base::Thread("LayerTreeTest")); | 522 impl_thread_.reset(new base::Thread("LayerTreeTest")); |
523 ASSERT_TRUE(impl_thread_->Start()); | 523 ASSERT_TRUE(impl_thread_->Start()); |
524 } | 524 } |
525 | 525 |
526 main_ccthread_ = cc::ThreadImpl::CreateForCurrentThread(); | 526 main_ccthread_ = cc::ThreadImpl::CreateForCurrentThread(); |
527 | 527 |
| 528 // Spend less time waiting for vsync because the output is mocked out. |
| 529 settings_.refresh_rate = 200.0; |
528 InitializeSettings(&settings_); | 530 InitializeSettings(&settings_); |
529 | 531 |
530 main_ccthread_->PostTask( | 532 main_ccthread_->PostTask( |
531 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); | 533 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); |
532 | 534 |
533 if (timeout_seconds_) { | 535 if (timeout_seconds_) { |
534 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); | 536 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); |
535 main_ccthread_->PostDelayedTask( | 537 main_ccthread_->PostDelayedTask( |
536 timeout_.callback(), | 538 timeout_.callback(), |
537 base::TimeDelta::FromSeconds(timeout_seconds_)); | 539 base::TimeDelta::FromSeconds(timeout_seconds_)); |
538 } | 540 } |
539 | 541 |
540 MessageLoop::current()->Run(); | 542 MessageLoop::current()->Run(); |
541 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 543 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
542 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 544 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
543 layer_tree_host_.reset(); | 545 layer_tree_host_.reset(); |
544 | 546 |
545 timeout_.Cancel(); | 547 timeout_.Cancel(); |
546 | 548 |
547 ASSERT_FALSE(layer_tree_host_.get()); | 549 ASSERT_FALSE(layer_tree_host_.get()); |
548 client_.reset(); | 550 client_.reset(); |
549 if (timed_out_) { | 551 if (timed_out_) { |
550 FAIL() << "Test timed out"; | 552 FAIL() << "Test timed out"; |
551 return; | 553 return; |
552 } | 554 } |
553 AfterTest(); | 555 AfterTest(); |
554 } | 556 } |
555 | 557 |
556 } // namespace cc | 558 } // namespace cc |
OLD | NEW |