| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 virtual void Layout() OVERRIDE { | 245 virtual void Layout() OVERRIDE { |
| 246 test_hooks_->Layout(); | 246 test_hooks_->Layout(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 249 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 250 float scale) OVERRIDE { | 250 float scale) OVERRIDE { |
| 251 test_hooks_->ApplyScrollAndScale(scroll_delta, scale); | 251 test_hooks_->ApplyScrollAndScale(scroll_delta, scale); |
| 252 } | 252 } |
| 253 | 253 |
| 254 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 254 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 255 return test_hooks_->CreateOutputSurface(); | 255 OVERRIDE { |
| 256 return test_hooks_->CreateOutputSurface(fallback); |
| 256 } | 257 } |
| 257 | 258 |
| 258 virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE { | 259 virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE { |
| 259 test_hooks_->DidInitializeOutputSurface(succeeded); | 260 test_hooks_->DidInitializeOutputSurface(succeeded); |
| 260 } | 261 } |
| 261 | 262 |
| 262 virtual void DidFailToInitializeOutputSurface() OVERRIDE { | 263 virtual void DidFailToInitializeOutputSurface() OVERRIDE { |
| 263 test_hooks_->DidFailToInitializeOutputSurface(); | 264 test_hooks_->DidFailToInitializeOutputSurface(); |
| 264 } | 265 } |
| 265 | 266 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 594 |
| 594 ASSERT_FALSE(layer_tree_host_.get()); | 595 ASSERT_FALSE(layer_tree_host_.get()); |
| 595 client_.reset(); | 596 client_.reset(); |
| 596 if (timed_out_) { | 597 if (timed_out_) { |
| 597 FAIL() << "Test timed out"; | 598 FAIL() << "Test timed out"; |
| 598 return; | 599 return; |
| 599 } | 600 } |
| 600 AfterTest(); | 601 AfterTest(); |
| 601 } | 602 } |
| 602 | 603 |
| 603 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { | 604 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) { |
| 604 scoped_ptr<FakeOutputSurface> output_surface; | 605 scoped_ptr<FakeOutputSurface> output_surface; |
| 605 if (delegating_renderer_) | 606 if (delegating_renderer_) |
| 606 output_surface = FakeOutputSurface::CreateDelegating3d(); | 607 output_surface = FakeOutputSurface::CreateDelegating3d(); |
| 607 else | 608 else |
| 608 output_surface = FakeOutputSurface::Create3d(); | 609 output_surface = FakeOutputSurface::Create3d(); |
| 609 output_surface_ = output_surface.get(); | 610 output_surface_ = output_surface.get(); |
| 610 return output_surface.PassAs<OutputSurface>(); | 611 return output_surface.PassAs<OutputSurface>(); |
| 611 } | 612 } |
| 612 | 613 |
| 613 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 614 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
| 614 OffscreenContextProviderForMainThread() { | 615 OffscreenContextProviderForMainThread() { |
| 615 if (!main_thread_contexts_.get() || | 616 if (!main_thread_contexts_.get() || |
| 616 main_thread_contexts_->DestroyedOnMainThread()) { | 617 main_thread_contexts_->DestroyedOnMainThread()) { |
| 617 main_thread_contexts_ = FakeContextProvider::Create(); | 618 main_thread_contexts_ = FakeContextProvider::Create(); |
| 618 if (!main_thread_contexts_->BindToCurrentThread()) | 619 if (!main_thread_contexts_->BindToCurrentThread()) |
| 619 main_thread_contexts_ = NULL; | 620 main_thread_contexts_ = NULL; |
| 620 } | 621 } |
| 621 return main_thread_contexts_; | 622 return main_thread_contexts_; |
| 622 } | 623 } |
| 623 | 624 |
| 624 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 625 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
| 625 OffscreenContextProviderForCompositorThread() { | 626 OffscreenContextProviderForCompositorThread() { |
| 626 if (!compositor_thread_contexts_.get() || | 627 if (!compositor_thread_contexts_.get() || |
| 627 compositor_thread_contexts_->DestroyedOnMainThread()) | 628 compositor_thread_contexts_->DestroyedOnMainThread()) |
| 628 compositor_thread_contexts_ = FakeContextProvider::Create(); | 629 compositor_thread_contexts_ = FakeContextProvider::Create(); |
| 629 return compositor_thread_contexts_; | 630 return compositor_thread_contexts_; |
| 630 } | 631 } |
| 631 | 632 |
| 632 } // namespace cc | 633 } // namespace cc |
| OLD | NEW |