| 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "cc/layers/texture_layer_client.h" | 10 #include "cc/layers/texture_layer_client.h" |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 : public LayerTreeTest, | 875 : public LayerTreeTest, |
| 876 public TextureLayerClient { | 876 public TextureLayerClient { |
| 877 public: | 877 public: |
| 878 TextureLayerLostContextTest() | 878 TextureLayerLostContextTest() |
| 879 : texture_(0), | 879 : texture_(0), |
| 880 draw_count_(0) {} | 880 draw_count_(0) {} |
| 881 | 881 |
| 882 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 882 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { |
| 883 texture_context_ = TestWebGraphicsContext3D::Create(); | 883 texture_context_ = TestWebGraphicsContext3D::Create(); |
| 884 texture_ = texture_context_->createTexture(); | 884 texture_ = texture_context_->createTexture(); |
| 885 scoped_ptr<TestWebGraphicsContext3D> context( | 885 return CreateFakeOutputSurface(); |
| 886 TestWebGraphicsContext3D::Create()); | |
| 887 return FakeOutputSurface::Create3d( | |
| 888 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | |
| 889 } | 886 } |
| 890 | 887 |
| 891 virtual unsigned PrepareTexture() OVERRIDE { | 888 virtual unsigned PrepareTexture() OVERRIDE { |
| 892 if (draw_count_ == 0) { | 889 if (draw_count_ == 0) { |
| 893 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 890 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 894 GL_INNOCENT_CONTEXT_RESET_ARB); | 891 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 895 } | 892 } |
| 896 return texture_; | 893 return texture_; |
| 897 } | 894 } |
| 898 | 895 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 scoped_refptr<TextureLayer> texture_layer_; | 943 scoped_refptr<TextureLayer> texture_layer_; |
| 947 scoped_ptr<TestWebGraphicsContext3D> texture_context_; | 944 scoped_ptr<TestWebGraphicsContext3D> texture_context_; |
| 948 unsigned texture_; | 945 unsigned texture_; |
| 949 int draw_count_; | 946 int draw_count_; |
| 950 }; | 947 }; |
| 951 | 948 |
| 952 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); | 949 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); |
| 953 | 950 |
| 954 } // namespace | 951 } // namespace |
| 955 } // namespace cc | 952 } // namespace cc |
| OLD | NEW |