split view: Set |is_resizing_| to false when ending split view.

The EndSplitView function contains logic to end resizing, but it does
not actually set |is_resizing_| to false. If |is_resizing_| is true,
then you can enter split view again and |is_resizing_| will still be
true. Issue 930323 probably seems too minor to worry about, but I filed
it as an excuse to fix this case which makes the code hard to reason
about and is probably responsible for several undiscovered bugs, because
it pretty much defeats the purpose of |is_resizing_|. My work on Issue
884930 will be simpler if my logic can rely on |is_resizing_|.

Test: ash_unittests SplitViewControllerTest.EndSplitViewWhileDragging
Bug: 930323
Change-Id: Iddb5f3d294e38c2e1990abfeff726bb93526609a
Reviewed-on: https://chromium-review.googlesource.com/c/1461497
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630805}
diff --git a/ash/wm/splitview/split_view_controller.cc b/ash/wm/splitview/split_view_controller.cc
index 55d556f..dd3f294 100644
--- a/ash/wm/splitview/split_view_controller.cc
+++ b/ash/wm/splitview/split_view_controller.cc
@@ -513,6 +513,7 @@
   // the resize. This can happen, for example, on the transition back to
   // clamshell mode or when a task is minimized during a resize.
   if (is_resizing_) {
+    is_resizing_ = false;
     FinishWindowResizing(left_window_);
     FinishWindowResizing(right_window_);
   }
diff --git a/ash/wm/splitview/split_view_controller_unittest.cc b/ash/wm/splitview/split_view_controller_unittest.cc
index ece9a48..52db25d 100644
--- a/ash/wm/splitview/split_view_controller_unittest.cc
+++ b/ash/wm/splitview/split_view_controller_unittest.cc
@@ -1834,6 +1834,26 @@
   EXPECT_EQ(0, observer.items_on_last_overview_end());
 }
 
+// Test that resizing ends properly if split view ends during divider dragging.
+TEST_F(SplitViewControllerTest, EndSplitViewWhileDragging) {
+  // Enter split view mode.
+  std::unique_ptr<aura::Window> window = CreateTestWindow();
+  split_view_controller()->SnapWindow(window.get(), SplitViewController::LEFT);
+
+  // Start resizing.
+  gfx::Rect divider_bounds =
+      split_view_divider()->GetDividerBoundsInScreen(false);
+  split_view_controller()->StartResize(divider_bounds.CenterPoint());
+
+  // Verify the setup.
+  ASSERT_TRUE(split_view_controller()->IsSplitViewModeActive());
+  ASSERT_TRUE(split_view_controller()->is_resizing());
+
+  // End split view and check that resizing has ended properly.
+  split_view_controller()->EndSplitView();
+  EXPECT_FALSE(split_view_controller()->is_resizing());
+}
+
 // Test the tab-dragging related functionalities in tablet mode. Tab(s) can be
 // dragged out of a window and then put in split view mode or merge into another
 // window.