| Index: cc/trees/layer_tree_host_unittest_context.cc | 
| diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc | 
| index 548ff36029ec9d518bb8765b9cfe31e2475b6158..27234e6746160a5aecddeef030173485fa53a455 100644 | 
| --- a/cc/trees/layer_tree_host_unittest_context.cc | 
| +++ b/cc/trees/layer_tree_host_unittest_context.cc | 
| @@ -60,7 +60,8 @@ class LayerTreeHostContextTest : public LayerTreeTest { | 
| times_create_failed_(0), | 
| committed_at_least_once_(false), | 
| context_should_support_io_surface_(false), | 
| -        fallback_context_works_(false) { | 
| +        fallback_context_works_(false), | 
| +        async_output_surface_creation_(false) { | 
| media::InitializeMediaLibraryForTesting(); | 
| } | 
|  | 
| @@ -150,6 +151,7 @@ class LayerTreeHostContextTest : public LayerTreeTest { | 
| bool committed_at_least_once_; | 
| bool context_should_support_io_surface_; | 
| bool fallback_context_works_; | 
| +  bool async_output_surface_creation_; | 
| }; | 
|  | 
| class LayerTreeHostContextTestLostContextSucceeds | 
| @@ -165,6 +167,24 @@ class LayerTreeHostContextTestLostContextSucceeds | 
|  | 
| virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 
|  | 
| +  virtual void RequestNewOutputSurface(bool fallback) OVERRIDE { | 
| +    if (async_output_surface_creation_) { | 
| +      MainThreadTaskRunner()->PostTask( | 
| +          FROM_HERE, | 
| +          base::Bind(&LayerTreeHostContextTestLostContextSucceeds:: | 
| +                         CreateAndSetOutputSurface, | 
| +                     base::Unretained(this), | 
| +                     fallback)); | 
| +    } else { | 
| +      CreateAndSetOutputSurface(fallback); | 
| +    } | 
| +  } | 
| + | 
| +  void CreateAndSetOutputSurface(bool fallback) { | 
| +    layer_tree_host()->SetOutputSurface( | 
| +        LayerTreeHostContextTest::CreateOutputSurface(fallback)); | 
| +  } | 
| + | 
| virtual void DidInitializeOutputSurface() OVERRIDE { | 
| if (first_initialized_) | 
| ++num_losses_; | 
| @@ -174,7 +194,7 @@ class LayerTreeHostContextTestLostContextSucceeds | 
| recovered_context_ = true; | 
| } | 
|  | 
| -  virtual void AfterTest() OVERRIDE { EXPECT_EQ(7u, test_case_); } | 
| +  virtual void AfterTest() OVERRIDE { EXPECT_EQ(11u, test_case_); } | 
|  | 
| virtual void DidCommitAndDrawFrame() OVERRIDE { | 
| // If the last frame had a context loss, then we'll commit again to | 
| @@ -208,24 +228,35 @@ class LayerTreeHostContextTestLostContextSucceeds | 
| 0,      // times_to_lose_during_draw | 
| 0,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| }, | 
| { | 
| 0,      // times_to_lose_during_commit | 
| 1,      // times_to_lose_during_draw | 
| 0,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| }, | 
| { | 
| 1,      // times_to_lose_during_commit | 
| 0,      // times_to_lose_during_draw | 
| 3,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| }, | 
| { | 
| 0,      // times_to_lose_during_commit | 
| 1,      // times_to_lose_during_draw | 
| 3,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| +        }, | 
| +        { | 
| +         0,      // times_to_lose_during_commit | 
| +         1,      // times_to_lose_during_draw | 
| +         3,      // times_to_fail_recreate | 
| +         false,  // fallback_context_works | 
| +         true,   // async_output_surface_creation | 
| }, | 
| // Losing the context and recreating it any number of times should | 
| // succeed. | 
| @@ -234,20 +265,44 @@ class LayerTreeHostContextTestLostContextSucceeds | 
| 0,      // times_to_lose_during_draw | 
| 0,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| +        }, | 
| +        { | 
| +         0,      // times_to_lose_during_commit | 
| +         10,     // times_to_lose_during_draw | 
| +         0,      // times_to_fail_recreate | 
| +         false,  // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| +        }, | 
| +        { | 
| +         10,     // times_to_lose_during_commit | 
| +         0,      // times_to_lose_during_draw | 
| +         0,      // times_to_fail_recreate | 
| +         false,  // fallback_context_works | 
| +         true,   // async_output_surface_creation | 
| }, | 
| { | 
| 0,      // times_to_lose_during_commit | 
| 10,     // times_to_lose_during_draw | 
| 0,      // times_to_fail_recreate | 
| false,  // fallback_context_works | 
| +         true,   // async_output_surface_creation | 
| }, | 
| // Losing the context, failing to reinitialize it, and making a fallback | 
| // context should work. | 
| { | 
| +         0,      // times_to_lose_during_commit | 
| +         1,      // times_to_lose_during_draw | 
| +         0,      // times_to_fail_recreate | 
| +         true,   // fallback_context_works | 
| +         false,  // async_output_surface_creation | 
| +        }, | 
| +        { | 
| 0,     // times_to_lose_during_commit | 
| 1,     // times_to_lose_during_draw | 
| 0,     // times_to_fail_recreate | 
| true,  // fallback_context_works | 
| +         true,  // async_output_surface_creation | 
| }, | 
| }; | 
|  | 
| @@ -263,6 +318,8 @@ class LayerTreeHostContextTestLostContextSucceeds | 
| times_to_lose_during_draw_ = kTests[test_case_].times_to_lose_during_draw; | 
| times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; | 
| fallback_context_works_ = kTests[test_case_].fallback_context_works; | 
| +    async_output_surface_creation_ = | 
| +        kTests[test_case_].async_output_surface_creation; | 
| ++test_case_; | 
| return true; | 
| } | 
| @@ -272,6 +329,7 @@ class LayerTreeHostContextTestLostContextSucceeds | 
| int times_to_lose_during_draw; | 
| int times_to_fail_recreate; | 
| bool fallback_context_works; | 
| +    bool async_output_surface_creation; | 
| }; | 
|  | 
| protected: | 
|  |