Run all LayerTreeHost tests with impl-side painting.

This will be always on in the future. All tests should pass with
it enabled.

If a pending tree is activated during draw, it requests another
redraw. If the context is also lost during the activation draw,
we end up trying to draw the active tree with its lost resources,
instead of doing a commit to get new resources. This is fixed and
covered by
SchedulerStateMachineTest.DontDrawBeforeCommitAfterLostOutputSurface

If you commit and pending tree with animations, but are unable to draw,
we would activate the pending tree via an animation tick, but never
unblock the main thread if it was waiting on the activation to finish
commit. This is covered by the animation unit tests.

Similarly, if you commited a tree without animations, it would be
activated by the thread proxy without drawing, but the main thread
would remain blocked. This was uncovered and is covered by layer tree
host tests.

When an active tree has layers in it, and the root layer is removed,
the impl side would crash trying to use the non-existent pending
tree's root layer. This is fixed in LayerTreeImpl::ClearRenderSurfaces()
and PushPersistedState().

BUG=239329

Review URL: https://chromiumcodereview.appspot.com/15004013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199721 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc
index 040b32bc..ca24016 100644
--- a/cc/trees/layer_tree_host_perftest.cc
+++ b/cc/trees/layer_tree_host_perftest.cc
@@ -131,7 +131,7 @@
 // Simulates a tab switcher scene with two stacks of 10 tabs each.
 TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) {
   ReadTestFile("10_10_layer_tree");
-  RunTest(false, false);
+  RunTest(false, false, false);
 }
 
 // Simulates a tab switcher scene with two stacks of 10 tabs each.
@@ -139,7 +139,7 @@
        TenTenSingleThread_FullDamageEachFrame) {
   full_damage_each_frame_ = true;
   ReadTestFile("10_10_layer_tree");
-  RunTest(false, false);
+  RunTest(false, false, false);
 }
 
 // Simulates main-thread scrolling on each frame.
@@ -166,18 +166,13 @@
 
 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) {
   ReadTestFile("long_scrollable_page");
-  RunTest(false, false);
+  RunTest(false, false, false);
 }
 
-// Simulates impl-side painting.
 class ImplSidePaintingPerfTest : public LayerTreeHostPerfTestJsonReader {
- public:
-  ImplSidePaintingPerfTest()
-      : LayerTreeHostPerfTestJsonReader() {}
-
-  virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
-    settings->impl_side_painting = true;
-  }
+ protected:
+  // Run test with impl-side painting.
+  void RunTestWithImplSidePainting() { RunTest(true, false, true); }
 };
 
 // Simulates a page with several large, transformed and animated layers.
@@ -185,7 +180,7 @@
   animation_driven_drawing_ = true;
   measure_commit_cost_ = true;
   ReadTestFile("heavy_layer_tree");
-  RunTest(true, false);
+  RunTestWithImplSidePainting();
 }
 
 }  // namespace