Commit 33562b43 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Add autotestPrivate.swapWindowsInSplitView

Based on the discussion in https://crrev.com/c/1743869, we decided to
add autotestPrivate.swapWindowsInSplitView() instead of using automation
API in Tast.

Tast side CL: https://crrev.com/c/1716679

TEST=arc.SplitView
BUG=135150701

Change-Id: I9e96b01daf0c8c84dc77363727dd4e38244562c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1758037Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Reviewed-by: default avatarMitsuru Oshima (slow) <oshima@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689581}
parent 4aaa9f29
......@@ -26,6 +26,9 @@ class ASH_EXPORT SplitViewTestApi {
// Snaps the window to left/right in the split view.
void SnapWindow(aura::Window* window, SnapPosition snap_position);
// Swaps left and right windows in the split view.
void SwapWindows();
private:
DISALLOW_COPY_AND_ASSIGN(SplitViewTestApi);
};
......
......@@ -31,4 +31,8 @@ void SplitViewTestApi::SnapWindow(
Shell::Get()->split_view_controller()->SnapWindow(window, position);
}
void SplitViewTestApi::SwapWindows() {
Shell::Get()->split_view_controller()->SwapWindows();
}
} // namespace ash
......@@ -2283,6 +2283,21 @@ AutotestPrivateGetArcAppWindowStateFunction::Run() {
arc_window->GetProperty(ash::kWindowStateTypeKey))))));
}
///////////////////////////////////////////////////////////////////////////////
// AutotestPrivateSwapWindowsInSplitViewFunction
///////////////////////////////////////////////////////////////////////////////
AutotestPrivateSwapWindowsInSplitViewFunction::
AutotestPrivateSwapWindowsInSplitViewFunction() = default;
AutotestPrivateSwapWindowsInSplitViewFunction::
~AutotestPrivateSwapWindowsInSplitViewFunction() = default;
ExtensionFunction::ResponseAction
AutotestPrivateSwapWindowsInSplitViewFunction::Run() {
ash::SplitViewTestApi().SwapWindows();
return RespondNow(NoArguments());
}
///////////////////////////////////////////////////////////////////////////////
// AutotestPrivateAPI
///////////////////////////////////////////////////////////////////////////////
......
......@@ -743,6 +743,17 @@ class AutotestPrivateGetArcAppWindowInfoFunction : public ExtensionFunction {
ResponseAction Run() override;
};
class AutotestPrivateSwapWindowsInSplitViewFunction : public ExtensionFunction {
public:
AutotestPrivateSwapWindowsInSplitViewFunction();
DECLARE_EXTENSION_FUNCTION("autotestPrivate.swapWindowsInSplitView",
AUTOTESTPRIVATE_SWAPWINDOWSINSPLITVIEW)
private:
~AutotestPrivateSwapWindowsInSplitViewFunction() override;
ResponseAction Run() override;
};
template <>
KeyedService*
BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor(
......
......@@ -531,5 +531,9 @@ namespace autotestPrivate {
// |callback|: called when the operation has completed.
static void getArcAppWindowInfo(DOMString packageName,
GetArcAppWindowInfoCallback callback);
// Swap the windows in the split view.
// |callback|: Called when the operation has completed.
static void swapWindowsInSplitView(VoidCallback callback);
};
};
......@@ -1437,6 +1437,7 @@ enum HistogramValue {
AUTOTESTPRIVATE_GETARCAPPWINDOWSTATE = 1374,
AUTOTESTPRIVATE_GETARCAPPWINDOWINFO = 1375,
AUTOTESTPRIVATE_GETALLINSTALLEDAPPS = 1376,
AUTOTESTPRIVATE_SWAPWINDOWSINSPLITVIEW = 1377,
// Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY
......
......@@ -20356,6 +20356,7 @@ Called by update_net_error_codes.py.-->
<int value="1374" label="AUTOTESTPRIVATE_GETARCAPPWINDOWSTATE"/>
<int value="1375" label="AUTOTESTPRIVATE_GETARCAPPWINDOWINFO"/>
<int value="1376" label="AUTOTESTPRIVATE_GETALLINSTALLEDAPPS"/>
<int value="1377" label="AUTOTESTPRIVATE_SWAPWINDOWSINSPLITVIEW"/>
</enum>
<enum name="ExtensionIconState">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment