168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// found in the LICENSE file.
468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include "ash/test/test_user_wallpaper_delegate.h"
668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
7f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/desktop_background/desktop_background_controller.h"
8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/shell.h"
9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
1068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)namespace ash {
1168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)namespace test {
1268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)TestUserWallpaperDelegate::TestUserWallpaperDelegate()
14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    : update_wallpaper_count_(0) {}
15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)TestUserWallpaperDelegate::~TestUserWallpaperDelegate() {}
17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void TestUserWallpaperDelegate::UpdateWallpaper(bool clear_cache) {
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  DefaultUserWallpaperDelegate::UpdateWallpaper(clear_cache);
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  if (!custom_wallpaper_.isNull()) {
21c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch    Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage(
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)        custom_wallpaper_, WALLPAPER_LAYOUT_STRETCH);
23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  update_wallpaper_count_++;
2568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}
2668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
2768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)int TestUserWallpaperDelegate::GetUpdateWallpaperCountAndReset() {
2868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  int count = update_wallpaper_count_;
2968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  update_wallpaper_count_ = 0;
3068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  return count;
3168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}
3268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
3368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}  // namespace test
3468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}  // namespace ash
35