Index: chrome/browser/chromeos/login/wallpaper_manager_test_utils.h |
diff --git a/chrome/browser/chromeos/login/wallpaper_manager_test_utils.h b/chrome/browser/chromeos/login/wallpaper_manager_test_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4782e7075be4e80651d0a131f467f711f10931d8 |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/wallpaper_manager_test_utils.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_ |
+#define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_ |
+ |
+#include <vector> |
+ |
+#include "ash/ash_constants.h" |
+#include "ui/gfx/image/image_skia.h" |
+ |
+namespace base { |
+class CommandLine; |
+class ScopedTempDir; |
+} // namespace base |
+ |
+namespace chromeos { |
+namespace wallpaper_manager_test_utils { |
+ |
+// Colors used for different default wallpapers by CreateCmdlineWallpapers(). |
+extern const SkColor kLargeDefaultWallpaperColor; |
+extern const SkColor kSmallDefaultWallpaperColor; |
+extern const SkColor kLargeGuestWallpaperColor; |
+extern const SkColor kSmallGuestWallpaperColor; |
+ |
+// 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.
|
+// conflict with any of the default wallpaper colors. |
+extern const SkColor kCustomWallpaperColor; |
+ |
+// Dimension used for width and height of default wallpaper images. A |
+// small value is used to minimize the amount of time spent compressing |
+// and writing images. |
+extern const int kWallpaperSize; |
+ |
+bool CreateJPEGImage(int width, |
Daniel Erat
2014/04/30 00:24:22
add a comment
Alexander Alekseev
2014/04/30 01:10:22
Done.
|
+ int height, |
+ SkColor color, |
+ std::vector<unsigned char>* output); |
+ |
+// Creates a test image of given size. |
+gfx::ImageSkia CreateTestImage(int width, int height, SkColor color); |
+ |
+// Writes a JPEG image of the specified size and color to |path|. Returns |
+// true on success. |
+bool WriteJPEGFile(const base::FilePath& path, |
+ int width, |
+ int height, |
+ SkColor color); |
+ |
+// Returns true if the color at the center of |image| is close to |
+// |expected_color|. (The center is used so small wallpaper images can be |
+// used.) |
+bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color); |
+ |
+// Wait until all wallpaper loading is done, and WallpaperManager comes into |
+// a stable state. |
+void WaitAsyncWallpaperLoadFinished(); |
+ |
+// Initializes default wallpaper paths "*default_*file" and writes JPEG |
+// wallpaper images to them. |
+// Only needs to be called (once) by tests that want to test loading of |
+// default wallpapers. |
+void CreateCmdlineWallpapers(const base::ScopedTempDir& dir, |
+ scoped_ptr<base::CommandLine>* command_line); |
+ |
+} // namespace wallpaper_manager_test_utils |
+ |
Daniel Erat
2014/04/30 00:24:22
delete blank line
Alexander Alekseev
2014/04/30 01:10:22
Done.
|
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_ |