applist: Add a metrics for homescreen animation smoothness.
This will help with future work for improving smoothness of animation
and drag. Adds a UI interactive test as well. A tast test was underway
but due to having to wait until new uprevs as well as apis still
underway (launcher, accelerator autotest private api) i think the
interactive UItest still has some values.
Test: added tests
Bug: 1024679
Change-Id: Ib95a1fc0a129404dff4b260bfb2527780afb7f37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1925715
Reviewed-by: Toni Baržić <[email protected]>
Reviewed-by: Ilya Sherman <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Commit-Queue: Sammie Quon <[email protected]>
Cr-Commit-Position: refs/heads/master@{#717494}
diff --git a/ash/shell_test_api.cc b/ash/shell_test_api.cc
index c482c1c5..bb197c4 100644
--- a/ash/shell_test_api.cc
+++ b/ash/shell_test_api.cc
@@ -29,6 +29,7 @@
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_observer.h"
+#include "ui/compositor/layer_animation_observer.h"
#include "ui/events/devices/device_data_manager_test_api.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
@@ -71,6 +72,38 @@
DISALLOW_COPY_AND_ASSIGN(PointerMoveLoopWaiter);
};
+class WindowAnimationWaiter : public ui::LayerAnimationObserver {
+ public:
+ explicit WindowAnimationWaiter(aura::Window* window)
+ : animator_(window->layer()->GetAnimator()) {
+ animator_->AddObserver(this);
+ }
+ ~WindowAnimationWaiter() override = default;
+
+ WindowAnimationWaiter(const WindowAnimationWaiter& other) = delete;
+ WindowAnimationWaiter& operator=(const WindowAnimationWaiter& rhs) = delete;
+
+ // ui::LayerAnimationObserver:
+ void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override {
+ if (!animator_->is_animating()) {
+ animator_->RemoveObserver(this);
+ run_loop_.Quit();
+ }
+ }
+ void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override {}
+ void OnLayerAnimationScheduled(
+ ui::LayerAnimationSequence* sequence) override {}
+
+ void Wait() {
+ DCHECK(animator_->is_animating());
+ run_loop_.Run();
+ }
+
+ private:
+ ui::LayerAnimator* animator_;
+ base::RunLoop run_loop_;
+};
+
} // namespace
ShellTestApi::ShellTestApi() : shell_(Shell::Get()) {}
@@ -204,6 +237,11 @@
run_loop.Run();
}
+void ShellTestApi::WaitForWindowFinishAnimating(aura::Window* window) {
+ WindowAnimationWaiter waiter(window);
+ waiter.Wait();
+}
+
PaginationModel* ShellTestApi::GetAppListPaginationModel() {
AppListView* view =
Shell::Get()->app_list_controller()->presenter()->GetView();