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

Side by Side Diff: Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

Issue 10456072: Merge 118276 - [chromium] Enable the CCLayerTreeHostTestCanDrawBlocksDrawing test in single-threade… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 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
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 virtual void beginCommitOnCCThread(CCLayerTreeHostImpl*) { } 66 virtual void beginCommitOnCCThread(CCLayerTreeHostImpl*) { }
67 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) { } 67 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) { }
68 virtual void prepareToDrawOnCCThread(CCLayerTreeHostImpl*) { } 68 virtual void prepareToDrawOnCCThread(CCLayerTreeHostImpl*) { }
69 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) { } 69 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) { }
70 virtual void animateLayers(CCLayerTreeHostImpl*, double monotonicTime) { } 70 virtual void animateLayers(CCLayerTreeHostImpl*, double monotonicTime) { }
71 virtual void willAnimateLayers(CCLayerTreeHostImpl*, double monotonicTime) { } 71 virtual void willAnimateLayers(CCLayerTreeHostImpl*, double monotonicTime) { }
72 virtual void applyScrollAndScale(const IntSize&, float) { } 72 virtual void applyScrollAndScale(const IntSize&, float) { }
73 virtual void updateAnimations(double monotonicTime) { } 73 virtual void updateAnimations(double monotonicTime) { }
74 virtual void layout() { } 74 virtual void layout() { }
75 virtual void didRecreateContext(bool succeded) { } 75 virtual void didRecreateContext(bool succeded) { }
76 virtual void didCommit() { }
76 virtual void didCommitAndDrawFrame() { } 77 virtual void didCommitAndDrawFrame() { }
77 78
78 // Implementation of CCLayerAnimationDelegate 79 // Implementation of CCLayerAnimationDelegate
79 virtual void notifyAnimationStarted(double time) { } 80 virtual void notifyAnimationStarted(double time) { }
80 virtual void notifyAnimationFinished(double time) { } 81 virtual void notifyAnimationFinished(double time) { }
81 }; 82 };
82 83
83 // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. 84 // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
84 class MockLayerTreeHostImpl : public CCLayerTreeHostImpl { 85 class MockLayerTreeHostImpl : public CCLayerTreeHostImpl {
85 public: 86 public:
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 GraphicsContext3D::Attributes attrs; 250 GraphicsContext3D::Attributes attrs;
250 WebGraphicsContext3D::Attributes webAttrs; 251 WebGraphicsContext3D::Attributes webAttrs;
251 webAttrs.alpha = attrs.alpha; 252 webAttrs.alpha = attrs.alpha;
252 253
253 OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsConte xt3DWithTextureTracking::create(webAttrs); 254 OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsConte xt3DWithTextureTracking::create(webAttrs);
254 return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(web Context.release(), GraphicsContext3D::RenderDirectlyToHostWindow); 255 return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(web Context.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
255 } 256 }
256 257
257 virtual void didCommit() OVERRIDE 258 virtual void didCommit() OVERRIDE
258 { 259 {
260 m_testHooks->didCommit();
259 } 261 }
260 262
261 virtual void didCommitAndDrawFrame() OVERRIDE 263 virtual void didCommitAndDrawFrame() OVERRIDE
262 { 264 {
263 m_testHooks->didCommitAndDrawFrame(); 265 m_testHooks->didCommitAndDrawFrame();
264 } 266 }
265 267
266 virtual void didCompleteSwapBuffers() OVERRIDE 268 virtual void didCompleteSwapBuffers() OVERRIDE
267 { 269 {
268 } 270 }
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 int m_numCommits; 836 int m_numCommits;
835 int m_numDraws; 837 int m_numDraws;
836 }; 838 };
837 839
838 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) 840 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread)
839 { 841 {
840 runTestThreaded(); 842 runTestThreaded();
841 } 843 }
842 844
843 // If the layerTreeHost says it can't draw, then we should not try to draw. 845 // If the layerTreeHost says it can't draw, then we should not try to draw.
844 // FIXME: Make this run in single threaded mode too. http://crbug.com/127481
845 class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTestThread Only { 846 class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTestThread Only {
846 public: 847 public:
847 CCLayerTreeHostTestCanDrawBlocksDrawing() 848 CCLayerTreeHostTestCanDrawBlocksDrawing()
848 : m_numCommits(0) 849 : m_numCommits(0)
849 { 850 {
850 } 851 }
851 852
852 virtual void beginTest() 853 virtual void beginTest()
853 { 854 {
854 } 855 }
855 856
856 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) 857 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
857 { 858 {
858 // Only the initial draw should bring us here. 859 // Only the initial draw should bring us here.
859 EXPECT_TRUE(impl->canDraw()); 860 EXPECT_TRUE(impl->canDraw());
860 EXPECT_EQ(0, impl->sourceFrameNumber()); 861 EXPECT_EQ(0, impl->sourceFrameNumber());
861 } 862 }
862 863
863 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) 864 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
864 { 865 {
865 if (m_numCommits >= 1) { 866 if (m_numCommits >= 1) {
866 // After the first commit, we should not be able to draw. 867 // After the first commit, we should not be able to draw.
867 EXPECT_FALSE(impl->canDraw()); 868 EXPECT_FALSE(impl->canDraw());
868 } 869 }
869 } 870 }
870 871
871 virtual void didCommitAndDrawFrame() 872 virtual void didCommit()
872 { 873 {
873 m_numCommits++; 874 m_numCommits++;
874 if (m_numCommits == 1) { 875 if (m_numCommits == 1) {
875 // Make the viewport empty so the host says it can't draw. 876 // Make the viewport empty so the host says it can't draw.
876 m_layerTreeHost->setViewportSize(IntSize(0, 0)); 877 m_layerTreeHost->setViewportSize(IntSize(0, 0));
877 878
878 OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4])); 879 OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4]));
879 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), IntRect(0, 0, 1, 1)); 880 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), IntRect(0, 0, 1, 1));
880 } else if (m_numCommits == 2) { 881 } else if (m_numCommits == 2) {
882 m_layerTreeHost->setNeedsRedraw();
881 m_layerTreeHost->setNeedsCommit(); 883 m_layerTreeHost->setNeedsCommit();
882 m_layerTreeHost->finishAllRendering(); 884 } else
883 endTest(); 885 endTest();
884 }
885 } 886 }
886 887
887 virtual void afterTest() 888 virtual void afterTest()
888 { 889 {
889 } 890 }
890 891
891 private: 892 private:
892 int m_numCommits; 893 int m_numCommits;
893 }; 894 };
894 895
895 TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing, runMultiThread) 896 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing)
896 {
897 runTestThreaded();
898 }
899 897
900 // beginLayerWrite should prevent draws from executing until a commit occurs 898 // beginLayerWrite should prevent draws from executing until a commit occurs
901 class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnl y { 899 class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnl y {
902 public: 900 public:
903 CCLayerTreeHostTestWriteLayersRedraw() 901 CCLayerTreeHostTestWriteLayersRedraw()
904 : m_numCommits(0) 902 : m_numCommits(0)
905 , m_numDraws(0) 903 , m_numDraws(0)
906 { 904 {
907 } 905 }
908 906
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 private: 2490 private:
2493 FloatSize m_scrollAmount; 2491 FloatSize m_scrollAmount;
2494 }; 2492 };
2495 2493
2496 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread) 2494 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread)
2497 { 2495 {
2498 runTestThreaded(); 2496 runTestThreaded();
2499 } 2497 }
2500 2498
2501 } // namespace 2499 } // namespace
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698