OLD | NEW |
---|---|
(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 // This class is actually used as namespace. | |
20 // It should not have non-static methods. | |
bshe
2014/04/29 23:24:06
You can probably just use namespace test_utils ins
Alexander Alekseev
2014/04/30 00:04:44
Done.
It used 'list_' member directly in the prev
| |
21 class WallpaperManagerTestUtils { | |
22 public: | |
23 static bool CreateJPEGImage(int width, | |
24 int height, | |
25 SkColor color, | |
26 std::vector<unsigned char>* output); | |
27 | |
28 // Creates a test image of given size. | |
29 static gfx::ImageSkia CreateTestImage(int width, int height, SkColor color); | |
30 | |
31 // Writes a JPEG image of the specified size and color to |path|. Returns | |
32 // true on success. | |
33 static bool WriteJPEGFile(const base::FilePath& path, | |
34 int width, | |
35 int height, | |
36 SkColor color); | |
37 | |
38 // Returns true if the color at the center of |image| is close to | |
39 // |expected_color|. (The center is used so small wallpaper images can be | |
40 // used.) | |
41 static bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color); | |
42 | |
43 // Wait until all wallpaper loading is done, and WallpaperManager comes into | |
44 // a stable state. | |
45 static void WaitAsyncWallpaperLoadFinished(); | |
46 | |
47 // Colors used for different default wallpapers by | |
48 // CreateCmdlineWallpapers(). | |
49 static const SkColor kLargeDefaultWallpaperColor; | |
50 static const SkColor kSmallDefaultWallpaperColor; | |
51 static const SkColor kLargeGuestWallpaperColor; | |
52 static const SkColor kSmallGuestWallpaperColor; | |
53 | |
54 // A custom color, pecifically chosen to not | |
55 // conflict with any of the default wallpaper colors. | |
56 static const SkColor kCustomWallpaperColor; | |
57 | |
58 // Dimension used for width and height of default wallpaper images. A | |
59 // small value is used to minimize the amount of time spent compressing | |
60 // and writing images. | |
61 static const int kWallpaperSize; | |
62 | |
63 // Initializes default wallpaper paths "*default_*file" and writes JPEG | |
64 // wallpaper images to them. | |
65 // Only needs to be called (once) by tests that want to test loading of | |
66 // default wallpapers. | |
67 static void CreateCmdlineWallpapers( | |
68 const base::ScopedTempDir& dir, | |
69 scoped_ptr<base::CommandLine>* command_line); | |
70 | |
71 private: | |
72 WallpaperManagerTestUtils(); // not implemented | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerTestUtils); | |
75 }; | |
76 | |
77 } // namespace chromeos | |
78 | |
79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_ | |
OLD | NEW |