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

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

Issue 10377150: Merge 116587 - [chromium] Don't draw when canDraw() is false (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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/tests/CCLayerTreeHostImplTest.cpp ('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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 private: 833 private:
834 int m_numCommits; 834 int m_numCommits;
835 int m_numDraws; 835 int m_numDraws;
836 }; 836 };
837 837
838 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) 838 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread)
839 { 839 {
840 runTestThreaded(); 840 runTestThreaded();
841 } 841 }
842 842
843 // 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 public:
847 CCLayerTreeHostTestCanDrawBlocksDrawing()
848 : m_numCommits(0)
849 {
850 }
851
852 virtual void beginTest()
853 {
854 }
855
856 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
857 {
858 // Only the initial draw should bring us here.
859 EXPECT_TRUE(impl->canDraw());
860 EXPECT_EQ(0, impl->sourceFrameNumber());
861 }
862
863 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
864 {
865 if (m_numCommits >= 1) {
866 // After the first commit, we should not be able to draw.
867 EXPECT_FALSE(impl->canDraw());
868 }
869 }
870
871 virtual void didCommitAndDrawFrame()
872 {
873 m_numCommits++;
874 if (m_numCommits == 1) {
875 // Make the viewport empty so the host says it can't draw.
876 m_layerTreeHost->setViewportSize(IntSize(0, 0));
877
878 OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4]));
879 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), IntRect(0, 0, 1, 1));
880 } else if (m_numCommits == 2) {
881 m_layerTreeHost->setNeedsCommit();
882 m_layerTreeHost->finishAllRendering();
883 endTest();
884 }
885 }
886
887 virtual void afterTest()
888 {
889 }
890
891 private:
892 int m_numCommits;
893 };
894
895 TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing, runMultiThread)
896 {
897 runTestThreaded();
898 }
843 899
844 // beginLayerWrite should prevent draws from executing until a commit occurs 900 // beginLayerWrite should prevent draws from executing until a commit occurs
845 class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnl y { 901 class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnl y {
846 public: 902 public:
847 CCLayerTreeHostTestWriteLayersRedraw() 903 CCLayerTreeHostTestWriteLayersRedraw()
848 : m_numCommits(0) 904 : m_numCommits(0)
849 , m_numDraws(0) 905 , m_numDraws(0)
850 { 906 {
851 } 907 }
852 908
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 private: 2496 private:
2441 FloatSize m_scrollAmount; 2497 FloatSize m_scrollAmount;
2442 }; 2498 };
2443 2499
2444 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread) 2500 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread)
2445 { 2501 {
2446 runTestThreaded(); 2502 runTestThreaded();
2447 } 2503 }
2448 2504
2449 } // namespace 2505 } // namespace
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698