| 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/debug/test_context_provider.h" | 8 #include "cc/debug/test_context_provider.h" |
| 9 #include "cc/debug/test_web_graphics_context_3d.h" | 9 #include "cc/debug/test_web_graphics_context_3d.h" |
| 10 #include "cc/layers/content_layer.h" | 10 #include "cc/layers/content_layer.h" |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 class LayerTreeHostContextTestDontUseLostResources | 1083 class LayerTreeHostContextTestDontUseLostResources |
| 1084 : public LayerTreeHostContextTest { | 1084 : public LayerTreeHostContextTest { |
| 1085 public: | 1085 public: |
| 1086 LayerTreeHostContextTestDontUseLostResources() | 1086 LayerTreeHostContextTestDontUseLostResources() |
| 1087 : lost_context_(false) { | 1087 : lost_context_(false) { |
| 1088 context_should_support_io_surface_ = true; | 1088 context_should_support_io_surface_ = true; |
| 1089 | 1089 |
| 1090 child_output_surface_ = FakeOutputSurface::Create3d(); | 1090 child_output_surface_ = FakeOutputSurface::Create3d(); |
| 1091 child_output_surface_->BindToClient(&output_surface_client_); | 1091 child_output_surface_->BindToClient(&output_surface_client_); |
| 1092 child_resource_provider_ = | 1092 child_resource_provider_ = |
| 1093 ResourceProvider::Create(child_output_surface_.get(), NULL, 0, false); | 1093 ResourceProvider::Create(child_output_surface_.get(), |
| 1094 NULL, |
| 1095 0, |
| 1096 false, |
| 1097 1); |
| 1094 } | 1098 } |
| 1095 | 1099 |
| 1096 static void EmptyReleaseCallback(unsigned sync_point, bool lost) {} | 1100 static void EmptyReleaseCallback(unsigned sync_point, bool lost) {} |
| 1097 | 1101 |
| 1098 virtual void SetupTree() OVERRIDE { | 1102 virtual void SetupTree() OVERRIDE { |
| 1099 WebKit::WebGraphicsContext3D* context3d = | 1103 WebKit::WebGraphicsContext3D* context3d = |
| 1100 child_output_surface_->context_provider()->Context3d(); | 1104 child_output_surface_->context_provider()->Context3d(); |
| 1101 | 1105 |
| 1102 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 1106 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 1103 | 1107 |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 EXPECT_FALSE(layer_tree_host); | 1792 EXPECT_FALSE(layer_tree_host); |
| 1789 } | 1793 } |
| 1790 }; | 1794 }; |
| 1791 | 1795 |
| 1792 SINGLE_AND_MULTI_THREAD_TEST_F( | 1796 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1793 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); | 1797 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); |
| 1794 | 1798 |
| 1795 class UIResourceLostTest : public LayerTreeHostContextTest { | 1799 class UIResourceLostTest : public LayerTreeHostContextTest { |
| 1796 public: | 1800 public: |
| 1797 UIResourceLostTest() : time_step_(0) {} | 1801 UIResourceLostTest() : time_step_(0) {} |
| 1802 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 1803 settings->texture_id_allocation_chunk_size = 1; |
| 1804 } |
| 1798 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 1805 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 1799 virtual void AfterTest() OVERRIDE {} | 1806 virtual void AfterTest() OVERRIDE {} |
| 1800 | 1807 |
| 1801 // This is called on the main thread after each commit and | 1808 // This is called on the main thread after each commit and |
| 1802 // DidActivateTreeOnThread, with the value of time_step_ at the time | 1809 // DidActivateTreeOnThread, with the value of time_step_ at the time |
| 1803 // of the call to DidActivateTreeOnThread. Similar tests will do | 1810 // of the call to DidActivateTreeOnThread. Similar tests will do |
| 1804 // work on the main thread in DidCommit but that is unsuitable because | 1811 // work on the main thread in DidCommit but that is unsuitable because |
| 1805 // the main thread work for these tests must happen after | 1812 // the main thread work for these tests must happen after |
| 1806 // DidActivateTreeOnThread, which happens after DidCommit with impl-side | 1813 // DidActivateTreeOnThread, which happens after DidCommit with impl-side |
| 1807 // painting. | 1814 // painting. |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 protected: | 2287 protected: |
| 2281 FakeContentLayerClient client_; | 2288 FakeContentLayerClient client_; |
| 2282 scoped_refptr<FakeContentLayer> layer_; | 2289 scoped_refptr<FakeContentLayer> layer_; |
| 2283 int num_commits_; | 2290 int num_commits_; |
| 2284 }; | 2291 }; |
| 2285 | 2292 |
| 2286 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 2293 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
| 2287 | 2294 |
| 2288 } // namespace | 2295 } // namespace |
| 2289 } // namespace cc | 2296 } // namespace cc |
| OLD | NEW |