Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win compile by including ContextProvider from output_surface_client.h Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
11 #include "cc/debug/frame_rate_counter.h" 11 #include "cc/debug/frame_rate_counter.h"
12 #include "cc/layers/content_layer.h" 12 #include "cc/layers/content_layer.h"
13 #include "cc/layers/content_layer_client.h" 13 #include "cc/layers/content_layer_client.h"
14 #include "cc/layers/io_surface_layer.h" 14 #include "cc/layers/io_surface_layer.h"
15 #include "cc/layers/layer_impl.h" 15 #include "cc/layers/layer_impl.h"
16 #include "cc/layers/picture_layer.h" 16 #include "cc/layers/picture_layer.h"
17 #include "cc/layers/scrollbar_layer.h" 17 #include "cc/layers/scrollbar_layer.h"
18 #include "cc/output/copy_output_request.h" 18 #include "cc/output/copy_output_request.h"
19 #include "cc/output/output_surface.h" 19 #include "cc/output/output_surface.h"
20 #include "cc/resources/prioritized_resource.h" 20 #include "cc/resources/prioritized_resource.h"
21 #include "cc/resources/prioritized_resource_manager.h" 21 #include "cc/resources/prioritized_resource_manager.h"
22 #include "cc/resources/resource_update_queue.h" 22 #include "cc/resources/resource_update_queue.h"
23 #include "cc/scheduler/frame_rate_controller.h" 23 #include "cc/scheduler/frame_rate_controller.h"
24 #include "cc/test/fake_content_layer.h" 24 #include "cc/test/fake_content_layer.h"
25 #include "cc/test/fake_content_layer_client.h" 25 #include "cc/test/fake_content_layer_client.h"
26 #include "cc/test/fake_layer_tree_host_client.h" 26 #include "cc/test/fake_layer_tree_host_client.h"
27 #include "cc/test/fake_output_surface.h" 27 #include "cc/test/fake_output_surface.h"
28 #include "cc/test/fake_picture_layer.h"
29 #include "cc/test/fake_picture_layer_impl.h"
28 #include "cc/test/fake_proxy.h" 30 #include "cc/test/fake_proxy.h"
29 #include "cc/test/fake_scrollbar_layer.h" 31 #include "cc/test/fake_scrollbar_layer.h"
30 #include "cc/test/geometry_test_utils.h" 32 #include "cc/test/geometry_test_utils.h"
31 #include "cc/test/layer_tree_test.h" 33 #include "cc/test/layer_tree_test.h"
32 #include "cc/test/occlusion_tracker_test_common.h" 34 #include "cc/test/occlusion_tracker_test_common.h"
33 #include "cc/trees/layer_tree_host_impl.h" 35 #include "cc/trees/layer_tree_host_impl.h"
34 #include "cc/trees/layer_tree_impl.h" 36 #include "cc/trees/layer_tree_impl.h"
35 #include "cc/trees/single_thread_proxy.h" 37 #include "cc/trees/single_thread_proxy.h"
36 #include "cc/trees/thread_proxy.h" 38 #include "cc/trees/thread_proxy.h"
37 #include "gpu/GLES2/gl2extchromium.h" 39 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 2796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 }; 2836 };
2835 2837
2836 TEST_F(LayerTreeHostTestNumFramesPending, DelegatingRenderer) { 2838 TEST_F(LayerTreeHostTestNumFramesPending, DelegatingRenderer) {
2837 RunTest(true, true, true); 2839 RunTest(true, true, true);
2838 } 2840 }
2839 2841
2840 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) { 2842 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) {
2841 RunTest(true, false, true); 2843 RunTest(true, false, true);
2842 } 2844 }
2843 2845
2846 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
2847 public:
2848 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2849 // PictureLayer can only be used with impl side painting enabled.
2850 settings->impl_side_painting = true;
2851 }
2852
2853 virtual void SetupTree() OVERRIDE {
2854 layer_ = FakePictureLayer::Create(&client_);
2855 layer_tree_host()->SetRootLayer(layer_);
2856 LayerTreeHostTest::SetupTree();
2857 }
2858
2859 virtual void BeginTest() OVERRIDE {
2860 initialized_gl_ = false;
2861 PostSetNeedsCommitToMainThread();
2862 }
2863
2864 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
2865 scoped_ptr<TestWebGraphicsContext3D> context3d(
2866 TestWebGraphicsContext3D::Create());
2867 context3d->set_support_swapbuffers_complete_callback(false);
2868
2869 return FakeOutputSurface::CreateDeferredGL(
2870 context3d.PassAs<WebKit::WebGraphicsContext3D>(),
2871 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice))
2872 .PassAs<OutputSurface>();
2873 }
2874
2875 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
2876 ASSERT_TRUE(host_impl->RootLayer());
2877 FakePictureLayerImpl* layer_impl =
2878 static_cast<FakePictureLayerImpl*>(host_impl->RootLayer());
2879 if (!initialized_gl_) {
2880 EXPECT_EQ(1u, layer_impl->append_quads_count());
2881 ImplThread()->PostTask(base::Bind(
2882 &LayerTreeHostTestDeferredInitialize::DeferredInitializeAndRedraw,
2883 base::Unretained(this),
2884 base::Unretained(host_impl)));
2885 } else {
2886 EXPECT_EQ(2u, layer_impl->append_quads_count());
2887 EndTest();
2888 }
2889 }
2890
2891 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) {
2892 EXPECT_TRUE(
2893 host_impl->DeferredInitialize(scoped_refptr<ContextProvider>()));
2894 initialized_gl_ = true;
2895
2896 // Force redraw again.
2897 host_impl->SetNeedsRedrawRect(gfx::Rect(1, 1));
2898 }
2899
2900 virtual void AfterTest() OVERRIDE {
2901 EXPECT_TRUE(initialized_gl_);
2902 }
2903
2904 private:
2905 FakeContentLayerClient client_;
2906 scoped_refptr<FakePictureLayer> layer_;
2907 bool initialized_gl_;
2908 };
2909
2910 MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize);
2911
2844 } // namespace 2912 } // namespace
2845 } // namespace cc 2913 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698