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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
9 #include "cc/delegated_renderer_layer.h" | 9 #include "cc/delegated_renderer_layer.h" |
10 #include "cc/delegated_renderer_layer_impl.h" | 10 #include "cc/delegated_renderer_layer_impl.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "cc/test/fake_scrollbar_theme_painter.h" | 23 #include "cc/test/fake_scrollbar_theme_painter.h" |
24 #include "cc/test/fake_video_frame_provider.h" | 24 #include "cc/test/fake_video_frame_provider.h" |
25 #include "cc/test/fake_web_graphics_context_3d.h" | 25 #include "cc/test/fake_web_graphics_context_3d.h" |
26 #include "cc/test/fake_web_scrollbar.h" | 26 #include "cc/test/fake_web_scrollbar.h" |
27 #include "cc/test/fake_web_scrollbar_theme_geometry.h" | 27 #include "cc/test/fake_web_scrollbar_theme_geometry.h" |
28 #include "cc/test/layer_tree_test_common.h" | 28 #include "cc/test/layer_tree_test_common.h" |
29 #include "cc/test/render_pass_test_common.h" | 29 #include "cc/test/render_pass_test_common.h" |
30 #include "cc/texture_layer.h" | 30 #include "cc/texture_layer.h" |
31 #include "cc/video_layer.h" | 31 #include "cc/video_layer.h" |
32 #include "cc/video_layer_impl.h" | 32 #include "cc/video_layer_impl.h" |
| 33 #include "gpu/GLES2/gl2extchromium.h" |
33 #include "media/base/media.h" | 34 #include "media/base/media.h" |
34 | 35 |
35 using media::VideoFrame; | 36 using media::VideoFrame; |
36 using WebKit::WebGraphicsContext3D; | 37 using WebKit::WebGraphicsContext3D; |
37 | 38 |
38 namespace cc { | 39 namespace cc { |
39 namespace { | 40 namespace { |
40 | 41 |
41 // These tests deal with losing the 3d graphics context. | 42 // These tests deal with losing the 3d graphics context. |
42 class LayerTreeHostContextTest : public ThreadedTest { | 43 class LayerTreeHostContextTest : public ThreadedTest { |
43 public: | 44 public: |
44 LayerTreeHostContextTest() | 45 LayerTreeHostContextTest() |
45 : ThreadedTest(), | 46 : ThreadedTest(), |
46 context3d_(NULL), | 47 context3d_(NULL), |
47 times_to_fail_create_(0), | 48 times_to_fail_create_(0), |
48 times_to_create_and_lose_(0), | 49 times_to_create_and_lose_(0), |
49 times_to_lose_during_commit_(0), | 50 times_to_lose_during_commit_(0), |
50 times_to_repeat_loss_(0), | 51 times_to_repeat_loss_(0), |
51 times_to_fail_recreate_(0) { | 52 times_to_fail_recreate_(0) { |
52 media::InitializeMediaLibraryForTesting(); | 53 media::InitializeMediaLibraryForTesting(); |
53 } | 54 } |
54 | 55 |
55 void LoseContext() { | 56 void LoseContext() { |
56 context3d_->loseContextCHROMIUM(); | 57 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 58 GL_INNOCENT_CONTEXT_RESET_ARB); |
57 context3d_ = NULL; | 59 context3d_ = NULL; |
58 } | 60 } |
59 | 61 |
60 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { | 62 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { |
61 return FakeWebGraphicsContext3D::Create(); | 63 return FakeWebGraphicsContext3D::Create(); |
62 } | 64 } |
63 | 65 |
64 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { | 66 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { |
65 if (times_to_fail_create_) { | 67 if (times_to_fail_create_) { |
66 --times_to_fail_create_; | 68 --times_to_fail_create_; |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 virtual void beginTest() OVERRIDE { | 798 virtual void beginTest() OVERRIDE { |
797 postSetNeedsCommitToMainThread(); | 799 postSetNeedsCommitToMainThread(); |
798 } | 800 } |
799 | 801 |
800 virtual void afterTest() OVERRIDE { | 802 virtual void afterTest() OVERRIDE { |
801 } | 803 } |
802 | 804 |
803 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() OVERRIDE { | 805 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() OVERRIDE { |
804 scoped_ptr<FakeWebGraphicsContext3D> context = | 806 scoped_ptr<FakeWebGraphicsContext3D> context = |
805 LayerTreeHostContextTest::CreateContext3d(); | 807 LayerTreeHostContextTest::CreateContext3d(); |
806 context->loseContextCHROMIUM(); | 808 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 809 GL_INNOCENT_CONTEXT_RESET_ARB); |
807 return context.Pass(); | 810 return context.Pass(); |
808 } | 811 } |
809 | 812 |
810 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 813 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
811 EXPECT_FALSE(succeeded); | 814 EXPECT_FALSE(succeeded); |
812 // If we make it this far without crashing, we pass! | 815 // If we make it this far without crashing, we pass! |
813 endTest(); | 816 endTest(); |
814 } | 817 } |
815 }; | 818 }; |
816 | 819 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 } | 859 } |
857 | 860 |
858 private: | 861 private: |
859 FakeContentLayerClient client_; | 862 FakeContentLayerClient client_; |
860 }; | 863 }; |
861 | 864 |
862 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) | 865 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) |
863 | 866 |
864 } // namespace | 867 } // namespace |
865 } // namespace cc | 868 } // namespace cc |
OLD | NEW |