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

ash / wallpaper / test_sea_pen_wallpaper_manager_session_delegate.cc [blame]

// Copyright 2024 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_sea_pen_wallpaper_manager_session_delegate.h"

#include <utility>

#include "ash/wallpaper/sea_pen_wallpaper_manager.h"
#include "ash/wallpaper/wallpaper_constants.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "components/account_id/account_id.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace ash {

TestSeaPenWallpaperManagerSessionDelegate::
    TestSeaPenWallpaperManagerSessionDelegate() = default;

TestSeaPenWallpaperManagerSessionDelegate::
    ~TestSeaPenWallpaperManagerSessionDelegate() = default;

base::FilePath TestSeaPenWallpaperManagerSessionDelegate::GetStorageDirectory(
    const AccountId& account_id) {
  if (!scoped_temp_dir_.IsValid()) {
    EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
  }
  // Public account and guest users do not have an account id key.
  const std::string account_identifier = account_id.HasAccountIdKey()
                                             ? account_id.GetAccountIdKey()
                                             : account_id.GetUserEmail();
  EXPECT_NE(std::string(), account_identifier);
  return scoped_temp_dir_.GetPath()
      .Append(account_identifier)
      .Append("wallpaper")
      .Append(wallpaper_constants::kSeaPenWallpaperDirName);
}

}  // namespace ash