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 / public / cpp / autotest_ambient_api.h [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.

#ifndef ASH_PUBLIC_CPP_AUTOTEST_AMBIENT_API_H_
#define ASH_PUBLIC_CPP_AUTOTEST_AMBIENT_API_H_

#include <string>

#include "ash/ash_export.h"
#include "base/functional/callback_forward.h"
#include "base/time/time.h"

namespace base {
class TickClock;
}  // namespace base

namespace ash {

// Exposes limited API for the autotest private APIs to interact with Ambient
// mode.
class ASH_EXPORT AutotestAmbientApi {
 public:
  AutotestAmbientApi();
  AutotestAmbientApi(const AutotestAmbientApi&) = delete;
  AutotestAmbientApi& operator=(const AutotestAmbientApi&) = delete;
  ~AutotestAmbientApi();

  // Wait |timeout| for |num_completions| photo transitions to complete. Calls
  // |on_complete| if successful and |on_timeout| if |timeout| elapses before
  // enough photo transitions occur.
  void WaitForPhotoTransitionAnimationCompleted(int num_completions,
                                                base::TimeDelta timeout,
                                                base::OnceClosure on_complete,
                                                base::OnceClosure on_timeout);

  // Wait |timeout| for the ambient video to successfully start playback. Calls
  // |on_complete| if successful and |on_error| if video playback failed
  // (including if |timeout| elapses before video playback starts). |on_error|
  // is invoked with an error message describing the failure.
  void WaitForVideoToStart(base::TimeDelta timeout,
                           base::OnceClosure on_complete,
                           base::OnceCallback<void(std::string)> on_error,
                           const base::TickClock* tick_clock = nullptr);
};

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_AUTOTEST_AMBIENT_API_H_