summaryrefslogtreecommitdiffstats
path: root/ui/compositor/test/test_layer_animation_observer.h
blob: 52789f8f3c96d197a2d0a0022f87402d13cc8e7f (plain)
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_
#define UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_

#include "base/compiler_specific.h"
#include "ui/compositor/layer_animation_observer.h"

namespace ui {

class LayerAnimationSequence;

// Listens to animation ended notifications. Remembers the last sequence that
// it was notified about.
class TestLayerAnimationObserver : public LayerAnimationObserver {
 public:
  TestLayerAnimationObserver();
  virtual ~TestLayerAnimationObserver();

  virtual void OnLayerAnimationEnded(
      LayerAnimationSequence* sequence) OVERRIDE;

  virtual void OnLayerAnimationAborted(
      LayerAnimationSequence* sequence) OVERRIDE;

  virtual void OnLayerAnimationScheduled(
      LayerAnimationSequence* sequence) OVERRIDE;

  virtual bool RequiresNotificationWhenAnimatorDestroyed() const OVERRIDE;

  const LayerAnimationSequence* last_ended_sequence() const {
    return last_ended_sequence_;
  }

  const LayerAnimationSequence* last_scheduled_sequence() const {
    return last_scheduled_sequence_;
  }

  const LayerAnimationSequence* last_aborted_sequence() const {
    return last_aborted_sequence_;
  }

  void set_requires_notification_when_animator_destroyed(bool value) {
    requires_notification_when_animator_destroyed_ = value;
  }

 private:
  const LayerAnimationSequence* last_ended_sequence_;
  const LayerAnimationSequence* last_scheduled_sequence_;
  const LayerAnimationSequence* last_aborted_sequence_;
  bool requires_notification_when_animator_destroyed_;

  // Copy and assign are allowed.
};

}  // namespace ui

#endif  // UI_COMPOSITOR_TEST_TEST_LAYER_ANIMATION_OBSERVER_H_