1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
ash / wm / desks / root_window_desk_switch_animator_test_api.cc [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/desks/root_window_desk_switch_animator_test_api.h"
#include "ash/wm/desks/root_window_desk_switch_animator.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_tree_owner.h"
namespace ash {
RootWindowDeskSwitchAnimatorTestApi::RootWindowDeskSwitchAnimatorTestApi(
RootWindowDeskSwitchAnimator* animator)
: animator_(animator) {
DCHECK(animator_);
}
RootWindowDeskSwitchAnimatorTestApi::~RootWindowDeskSwitchAnimatorTestApi() =
default;
ui::Layer* RootWindowDeskSwitchAnimatorTestApi::GetAnimationLayer() {
return animator_->animation_layer_owner_->root();
}
ui::Layer*
RootWindowDeskSwitchAnimatorTestApi::GetScreenshotLayerOfDeskWithIndex(
int desk_index) {
auto screenshot_layers = animator_->screenshot_layers_;
DCHECK_GE(desk_index, 0);
DCHECK_LT(desk_index, static_cast<int>(screenshot_layers.size()));
ui::Layer* layer = screenshot_layers[desk_index];
DCHECK(layer);
return layer;
}
int RootWindowDeskSwitchAnimatorTestApi::GetEndingDeskIndex() const {
return animator_->ending_desk_index_;
}
DeskSwitchAnimationType RootWindowDeskSwitchAnimatorTestApi::GetAnimatorType()
const {
return animator_->type_;
}
void RootWindowDeskSwitchAnimatorTestApi::SetOnStartingScreenshotTakenCallback(
base::OnceClosure callback) {
animator_->on_starting_screenshot_taken_callback_for_testing_ =
std::move(callback);
}
void RootWindowDeskSwitchAnimatorTestApi::SetOnEndingScreenshotTakenCallback(
base::OnceClosure callback) {
animator_->on_ending_screenshot_taken_callback_for_testing_ =
std::move(callback);
}
} // namespace ash