ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / chromeos / login / users / wallpaper / wallpaper_manager_test_utils.h
blob1b53d34cd0d721f9b3684b6ff9902fe5293a50f7
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_TEST_UTILS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_TEST_UTILS_H_
8 #include <vector>
10 #include "ash/ash_constants.h"
11 #include "ui/gfx/image/image_skia.h"
13 namespace base {
14 class CommandLine;
15 class ScopedTempDir;
16 } // namespace base
18 namespace chromeos {
19 namespace wallpaper_manager_test_utils {
21 // Colors used for different default wallpapers by CreateCmdlineWallpapers().
22 extern const SkColor kLargeDefaultWallpaperColor;
23 extern const SkColor kSmallDefaultWallpaperColor;
24 extern const SkColor kLargeGuestWallpaperColor;
25 extern const SkColor kSmallGuestWallpaperColor;
26 extern const SkColor kLargeChildWallpaperColor;
27 extern const SkColor kSmallChildWallpaperColor;
29 // A custom color, specifically chosen to not
30 // conflict with any of the default wallpaper colors.
31 extern const SkColor kCustomWallpaperColor;
33 // Dimension used for width and height of default wallpaper images. A
34 // small value is used to minimize the amount of time spent compressing
35 // and writing images.
36 extern const int kWallpaperSize;
38 // Creates compressed JPEG image of solid color.
39 // Result bytes are written to |output|.
40 // Returns true if gfx::JPEGCodec::Encode() succeeds.
41 bool CreateJPEGImage(int width,
42 int height,
43 SkColor color,
44 std::vector<unsigned char>* output);
46 // Creates a test image of given size.
47 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color);
49 // Writes a JPEG image of the specified size and color to |path|. Returns
50 // true on success.
51 bool WriteJPEGFile(const base::FilePath& path,
52 int width,
53 int height,
54 SkColor color);
56 // Returns true if the color at the center of |image| is close to
57 // |expected_color|. (The center is used so small wallpaper images can be
58 // used.)
59 bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color);
61 // Wait until all wallpaper loading is done, and WallpaperManager comes into
62 // a stable state.
63 void WaitAsyncWallpaperLoadFinished();
65 // Initializes default wallpaper paths "*default_*file" and writes JPEG
66 // wallpaper images to them.
67 // Only needs to be called (once) by tests that want to test loading of
68 // default wallpapers.
69 void CreateCmdlineWallpapers(const base::ScopedTempDir& dir,
70 scoped_ptr<base::CommandLine>* command_line);
72 } // namespace wallpaper_manager_test_utils
73 } // namespace chromeos
75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_TEST_UTILS_H_