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 / test_wallpaper_drivefs_delegate.cc [blame]

// Copyright 2023 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/wallpaper/test_wallpaper_drivefs_delegate.h"

#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "components/account_id/account_id.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_unittest_util.h"

namespace ash {

TestWallpaperDriveFsDelegate::TestWallpaperDriveFsDelegate() = default;

TestWallpaperDriveFsDelegate::~TestWallpaperDriveFsDelegate() = default;

void TestWallpaperDriveFsDelegate::Reset() {
  save_wallpaper_account_id_.clear();
  get_wallpaper_path_account_id_.clear();
}

base::FilePath TestWallpaperDriveFsDelegate::GetWallpaperPath(
    const AccountId& account_id) {
  get_wallpaper_path_account_id_ = account_id;
  return base::FilePath();
}

void TestWallpaperDriveFsDelegate::SaveWallpaper(
    const AccountId& account_id,
    const base::FilePath& source,
    base::OnceCallback<void(bool)> callback) {
  save_wallpaper_account_id_ = account_id;
  std::move(callback).Run(true);
}

void TestWallpaperDriveFsDelegate::GetWallpaperModificationTime(
    const AccountId& account_id,
    GetWallpaperModificationTimeCallback callback) {
  std::move(callback).Run(base::Time::Now());
}

void TestWallpaperDriveFsDelegate::WaitForWallpaperChange(
    const AccountId& account_id,
    WaitForWallpaperChangeCallback callback) {
  std::move(callback).Run(/*success=*/true);
}

void TestWallpaperDriveFsDelegate::DownloadAndDecodeWallpaper(
    const AccountId& account_id,
    ImageDownloader::DownloadCallback callback) {
  std::move(callback).Run(gfx::test::CreateImageSkia(10));
}

}  // namespace ash