Chromium Code Reviews| 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..c4be2aad9fc14b2d4ec6d5c079186fccd61be28c |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/login/wallpaper_manager_test_utils.h |
| @@ -0,0 +1,79 @@ |
| +// 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 { |
| +// This class is actually used as namespace. |
| +// 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
|
| +class WallpaperManagerTestUtils { |
| + public: |
| + static bool CreateJPEGImage(int width, |
| + int height, |
| + SkColor color, |
| + std::vector<unsigned char>* output); |
| + |
| + // Creates a test image of given size. |
| + static 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. |
| + static 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.) |
| + static bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color); |
| + |
| + // Wait until all wallpaper loading is done, and WallpaperManager comes into |
| + // a stable state. |
| + static void WaitAsyncWallpaperLoadFinished(); |
| + |
| + // Colors used for different default wallpapers by |
| + // CreateCmdlineWallpapers(). |
| + static const SkColor kLargeDefaultWallpaperColor; |
| + static const SkColor kSmallDefaultWallpaperColor; |
| + static const SkColor kLargeGuestWallpaperColor; |
| + static const SkColor kSmallGuestWallpaperColor; |
| + |
| + // A custom color, pecifically chosen to not |
| + // conflict with any of the default wallpaper colors. |
| + static 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. |
| + static const int kWallpaperSize; |
| + |
| + // 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. |
| + static void CreateCmdlineWallpapers( |
| + const base::ScopedTempDir& dir, |
| + scoped_ptr<base::CommandLine>* command_line); |
| + |
| + private: |
| + WallpaperManagerTestUtils(); // not implemented |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WallpaperManagerTestUtils); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_TEST_UTILS_H_ |