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

ash / system / power / power_event_observer_test_api.h [blame]

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_POWER_POWER_EVENT_OBSERVER_TEST_API_H_
#define ASH_SYSTEM_POWER_POWER_EVENT_OBSERVER_TEST_API_H_

#include "base/memory/raw_ptr.h"
#include "chromeos/dbus/power/power_manager_client.h"

namespace ui {
class Compositor;
}

namespace ash {

class PowerEventObserver;

class PowerEventObserverTestApi {
 public:
  explicit PowerEventObserverTestApi(PowerEventObserver* power_event_observer);

  PowerEventObserverTestApi(const PowerEventObserverTestApi&) = delete;
  PowerEventObserverTestApi& operator=(const PowerEventObserverTestApi&) =
      delete;

  ~PowerEventObserverTestApi();

  void SendLidEvent(chromeos::PowerManagerClient::LidState state);

  void CompositingDidCommit(ui::Compositor* compositor);
  void CompositingStarted(ui::Compositor* compositor);
  void CompositingAckDeprecated(ui::Compositor* compositor);

  // Same as calling CompositingDidCommit, CompositingStarted and
  // CompositingAckDeprecated in sequence.
  void CompositeFrame(ui::Compositor* compositor);

  bool SimulateCompositorsReadyForSuspend();

  bool TrackingLockOnSuspendUsage() const;

 private:
  raw_ptr<PowerEventObserver> power_event_observer_;
};

}  // namespace ash

#endif  // ASH_SYSTEM_POWER_POWER_EVENT_OBSERVER_TEST_API_H_