| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UTIL_
H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UTIL_
H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UTIL_
H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UTIL_
H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class ImageSkia; | 23 class ImageSkia; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 namespace test { | 27 namespace test { |
| 28 | 28 |
| 29 extern const char kUserAvatarImage1RelativePath[]; | 29 extern const char kUserAvatarImage1RelativePath[]; |
| 30 extern const char kUserAvatarImage2RelativePath[]; | 30 extern const char kUserAvatarImage2RelativePath[]; |
| 31 // Points to a png file with transparent pixels. |
| 32 extern const char kUserAvatarImage3RelativePath[]; |
| 31 | 33 |
| 32 // Returns |true| if the two given images are pixel-for-pixel identical. | 34 // Returns |true| if the two given images are pixel-for-pixel identical. |
| 33 bool AreImagesEqual(const gfx::ImageSkia& first, const gfx::ImageSkia& second); | 35 bool AreImagesEqual(const gfx::ImageSkia& first, const gfx::ImageSkia& second); |
| 34 | 36 |
| 35 class ImageLoader : public ImageDecoder::ImageRequest { | 37 class ImageLoader : public ImageDecoder::ImageRequest { |
| 36 public: | 38 public: |
| 37 explicit ImageLoader(const base::FilePath& path); | 39 explicit ImageLoader(const base::FilePath& path); |
| 38 ~ImageLoader() override; | 40 ~ImageLoader() override; |
| 39 | 41 |
| 40 std::unique_ptr<gfx::ImageSkia> Load(); | 42 std::unique_ptr<gfx::ImageSkia> Load(); |
| 41 | 43 |
| 42 // ImageDecoder::ImageRequest: | 44 // ImageDecoder::ImageRequest: |
| 43 void OnImageDecoded(const SkBitmap& decoded_image) override; | 45 void OnImageDecoded(const SkBitmap& decoded_image) override; |
| 44 void OnDecodeImageFailed() override; | 46 void OnDecodeImageFailed() override; |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 base::FilePath path_; | 49 base::FilePath path_; |
| 48 base::RunLoop run_loop_; | 50 base::RunLoop run_loop_; |
| 49 | 51 |
| 50 std::unique_ptr<gfx::ImageSkia> decoded_image_; | 52 std::unique_ptr<gfx::ImageSkia> decoded_image_; |
| 51 | 53 |
| 52 DISALLOW_COPY_AND_ASSIGN(ImageLoader); | 54 DISALLOW_COPY_AND_ASSIGN(ImageLoader); |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 } // namespace test | 57 } // namespace test |
| 56 } // namespace chromeos | 58 } // namespace chromeos |
| 57 | 59 |
| 58 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UT
IL_H_ | 60 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_MANAGER_TEST_UT
IL_H_ |
| OLD | NEW |