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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 14925009: Run all LayerTreeHost tests with a delegating renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 40983ced67bfcd2fefb460feca931c53318c106a..5bfd864cb43cd43112af61c6590db8e7444a67e5 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -369,7 +369,8 @@ class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest {
int num_commits_;
};
-MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadback);
+// No readbacks with a delegating renderer.
+MULTI_THREAD_DIRECT_RENDERER_TEST_F(LayerTreeHostTestCompositeAndReadback);
class LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws
: public LayerTreeHostTest {
@@ -401,7 +402,8 @@ class LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws
int num_commits_;
};
-MULTI_THREAD_TEST_F(
+// No readbacks with a delegating renderer.
+MULTI_THREAD_DIRECT_RENDERER_TEST_F(
LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws);
// If the layerTreeHost says it can't draw, Then we should not try to draw.
@@ -434,8 +436,13 @@ class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest {
// Make the viewport empty so the host says it can't draw.
layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
} else if (num_commits_ == 2) {
- char pixels[4];
- layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1));
+ if (delegating_renderer()) {
+ // No readbacks with a delegating renderer.
+ layer_tree_host()->SetNeedsCommit();
+ } else {
+ char pixels[4];
+ layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1));
+ }
} else if (num_commits_ == 3) {
// Let it draw so we go idle and end the test.
layer_tree_host()->SetViewportSize(gfx::Size(1, 1));
@@ -542,7 +549,9 @@ class LayerTreeHostTestCompositeAndReadbackWhileInvisible
int num_commits_;
};
-MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackWhileInvisible);
+// No readbacks with a delegating renderer.
+MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostTestCompositeAndReadbackWhileInvisible);
class LayerTreeHostTestAbortFrameWhenInvisible : public LayerTreeHostTest {
public:
@@ -956,7 +965,7 @@ class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest {
TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
impl->output_surface()->context3d());
- // Number of textures used for draw should always be one for each layer.
+ // We draw/ship one texture each frame for each layer.
EXPECT_EQ(2u, context->NumUsedTextures());
context->ResetUsedTextures();
}
@@ -1183,7 +1192,9 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
int num_commits_;
};
-MULTI_THREAD_TEST_F(LayerTreeHostTestAtomicCommitWithPartialUpdate);
+// Partial updates are not possible with a delegating renderer.
+MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostTestAtomicCommitWithPartialUpdate);
class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest {
public:
@@ -1243,7 +1254,9 @@ class LayerTreeHostTestCompositeAndReadbackCleanup : public LayerTreeHostTest {
virtual void AfterTest() OVERRIDE {}
};
-SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackCleanup);
+// No readbacks with a delegating renderer.
+SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostTestCompositeAndReadbackCleanup);
class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
: public LayerTreeHostTest {
@@ -1336,7 +1349,8 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
scoped_refptr<FakeContentLayer> replica_layer2_;
};
-SINGLE_AND_MULTI_THREAD_TEST_F(
+ // Surfaces don't exist with a delegated renderer.
+SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit);
class EvictionTestLayer : public Layer {
@@ -1886,19 +1900,13 @@ class LayerTreeHostTestMaxPendingFrames : public LayerTreeHostTest {
public:
LayerTreeHostTestMaxPendingFrames() : LayerTreeHostTest() {}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
- if (delegating_renderer_)
- return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>();
- return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
- }
-
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
DCHECK(host_impl->proxy()->HasImplThread());
const ThreadProxy* proxy = static_cast<ThreadProxy*>(host_impl->proxy());
- if (delegating_renderer_) {
+ if (delegating_renderer()) {
EXPECT_EQ(1, proxy->MaxFramesPendingForTesting());
} else {
EXPECT_EQ(FrameRateController::DEFAULT_MAX_FRAMES_PENDING,
@@ -1908,19 +1916,14 @@ class LayerTreeHostTestMaxPendingFrames : public LayerTreeHostTest {
}
virtual void AfterTest() OVERRIDE {}
-
- protected:
- bool delegating_renderer_;
};
TEST_F(LayerTreeHostTestMaxPendingFrames, DelegatingRenderer) {
- delegating_renderer_ = true;
- RunTest(true);
+ RunTest(true, true);
}
TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) {
- delegating_renderer_ = false;
- RunTest(true);
+ RunTest(true, false);
}
class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
@@ -2561,7 +2564,8 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
gfx::Size io_surface_size_;
};
-SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestIOSurfaceDrawing);
+SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostTestIOSurfaceDrawing);
class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
protected:
@@ -2661,24 +2665,25 @@ class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
scoped_refptr<FakeContentLayer> child;
};
+// Readback can't be done with a delegating renderer.
TEST_F(LayerTreeHostTestAsyncReadback, GLRenderer_RunSingleThread) {
use_gl_renderer_ = true;
- RunTest(false);
+ RunTest(false, false);
}
TEST_F(LayerTreeHostTestAsyncReadback, GLRenderer_RunMultiThread) {
use_gl_renderer_ = true;
- RunTest(true);
+ RunTest(true, false);
}
TEST_F(LayerTreeHostTestAsyncReadback, SoftwareRenderer_RunSingleThread) {
use_gl_renderer_ = false;
- RunTest(false);
+ RunTest(false, false);
}
TEST_F(LayerTreeHostTestAsyncReadback, SoftwareRenderer_RunMultiThread) {
use_gl_renderer_ = false;
- RunTest(true);
+ RunTest(true, false);
}
class LayerTreeHostTestAsyncReadbackLayerDestroyed : public LayerTreeHostTest {
@@ -2772,18 +2777,11 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestAsyncReadbackLayerDestroyed);
class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
public:
- LayerTreeHostTestNumFramesPending()
- : delegating_renderer_(false),
- frame_(0) {}
-
- virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
- if (delegating_renderer_)
- return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>();
- return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
+ virtual void BeginTest() OVERRIDE {
+ frame_ = 0;
+ PostSetNeedsCommitToMainThread();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
-
// Round 1: commit + draw
// Round 2: commit only (no draw/swap)
// Round 3: draw only (no commit)
@@ -2801,6 +2799,8 @@ class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
case 3:
// CompositeAndReadback in Round 4, first commit.
EXPECT_EQ(2, frame_);
+ if (delegating_renderer())
+ layer_tree_host()->SetNeedsCommit();
break;
case 4:
// Round 4 done.
@@ -2824,7 +2824,13 @@ class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
case 2:
// Round 3 done.
EXPECT_EQ(2, commit);
- layer_tree_host()->CompositeAndReadback(pixels, gfx::Rect(0, 0, 1, 1));
+ if (delegating_renderer()) {
+ // Delegating renderer cannot readback.
+ layer_tree_host()->SetNeedsCommit();
piman 2013/05/09 20:38:47 The entire point of this test was to make sure Com
danakj 2013/05/09 22:42:37 I've restored this.
+ } else {
+ layer_tree_host()->CompositeAndReadback(pixels,
+ gfx::Rect(0, 0, 1, 1));
+ }
break;
case 3:
// Round 5 done.
@@ -2842,18 +2848,15 @@ class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
virtual void AfterTest() OVERRIDE {}
protected:
- bool delegating_renderer_;
int frame_;
};
TEST_F(LayerTreeHostTestNumFramesPending, DelegatingRenderer) {
- delegating_renderer_ = true;
- RunTest(true);
+ RunTest(true, true);
}
TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) {
- delegating_renderer_ = false;
- RunTest(true);
+ RunTest(true, false);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698