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

ash / wallpaper / wallpaper_controller_test_api.h [blame]

// Copyright 2017 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_WALLPAPER_WALLPAPER_CONTROLLER_TEST_API_H_
#define ASH_WALLPAPER_WALLPAPER_CONTROLLER_TEST_API_H_

#include "ash/ash_export.h"
#include "ash/public/cpp/wallpaper/wallpaper_info.h"
#include "ash/wallpaper/wallpaper_utils/wallpaper_calculated_colors.h"
#include "base/memory/raw_ptr.h"
#include "components/account_id/account_id.h"

namespace ash {

class WallpaperControllerImpl;

class ASH_EXPORT WallpaperControllerTestApi {
 public:
  explicit WallpaperControllerTestApi(WallpaperControllerImpl* controller);

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

  virtual ~WallpaperControllerTestApi();

  // Simulates starting the fullscreen wallpaper preview.
  void StartWallpaperPreview();

  // Simulates ending the fullscreen wallpaper preview.
  // |confirm_preview_wallpaper| indicates if the preview wallpaper should be
  // set as the actual user wallpaper.
  void EndWallpaperPreview(bool confirm_preview_wallpaper);

  // Force a specific set of `calculated_colors` to be set to
  // WallpaperController. Cancels any ongoing requests to calculate wallpaper
  // colors.
  void SetCalculatedColors(const WallpaperCalculatedColors& calculated_colors);

  // Set `calculated_colors` back to nullopt.
  void ResetCalculatedColors();

  // Set a default wallpaper info to simplify testing.
  void SetDefaultWallpaper(const AccountId& account_id);

  // Shows a solid color wallpaper associated with `wallpaper_info`.
  void ShowWallpaperImage(const WallpaperInfo& wallpaper_info,
                          bool preview_mode,
                          bool is_override);

 private:
  raw_ptr<WallpaperControllerImpl, DanglingUntriaged> controller_;
};

}  // namespace ash

#endif  // ASH_WALLPAPER_WALLPAPER_CONTROLLER_TEST_API_H_