Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/browser/chromeos/login/wallpaper_manager_test_utils.h

Issue 253833006: Add browser test for CustomizationWallpaperDownloader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move utils to namespace. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_
7
8 #include <vector>
9
10 #include "ash/ash_constants.h"
11 #include "ui/gfx/image/image_skia.h"
12
13 namespace base {
14 class CommandLine;
15 class ScopedTempDir;
16 } // namespace base
17
18 namespace chromeos {
19 namespace wallpaper_manager_test_utils {
20
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
27 // A custom color, pecifically chosen to not
Daniel Erat 2014/04/30 00:24:22 s/pecifically/specifically/
Alexander Alekseev 2014/04/30 01:10:22 Done.
28 // conflict with any of the default wallpaper colors.
29 extern const SkColor kCustomWallpaperColor;
30
31 // Dimension used for width and height of default wallpaper images. A
32 // small value is used to minimize the amount of time spent compressing
33 // and writing images.
34 extern const int kWallpaperSize;
35
36 bool CreateJPEGImage(int width,
Daniel Erat 2014/04/30 00:24:22 add a comment
Alexander Alekseev 2014/04/30 01:10:22 Done.
37 int height,
38 SkColor color,
39 std::vector<unsigned char>* output);
40
41 // Creates a test image of given size.
42 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color);
43
44 // Writes a JPEG image of the specified size and color to |path|. Returns
45 // true on success.
46 bool WriteJPEGFile(const base::FilePath& path,
47 int width,
48 int height,
49 SkColor color);
50
51 // Returns true if the color at the center of |image| is close to
52 // |expected_color|. (The center is used so small wallpaper images can be
53 // used.)
54 bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color);
55
56 // Wait until all wallpaper loading is done, and WallpaperManager comes into
57 // a stable state.
58 void WaitAsyncWallpaperLoadFinished();
59
60 // Initializes default wallpaper paths "*default_*file" and writes JPEG
61 // wallpaper images to them.
62 // Only needs to be called (once) by tests that want to test loading of
63 // default wallpapers.
64 void CreateCmdlineWallpapers(const base::ScopedTempDir& dir,
65 scoped_ptr<base::CommandLine>* command_line);
66
67 } // namespace wallpaper_manager_test_utils
68
Daniel Erat 2014/04/30 00:24:22 delete blank line
Alexander Alekseev 2014/04/30 01:10:22 Done.
69 } // namespace chromeos
70
71 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698