| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/desktop_background/wallpaper_resizer.h" | 5 #include "ash/desktop_background/wallpaper_resizer.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/wallpaper_resizer_observer.h" | 7 #include "ash/desktop_background/wallpaper_resizer_observer.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 EXPECT_EQ(image.width(), kTargetWidth); | 48 EXPECT_EQ(image.width(), kTargetWidth); |
| 49 EXPECT_EQ(image.height(), kTargetHeight); | 49 EXPECT_EQ(image.height(), kTargetHeight); |
| 50 const SkBitmap* image_bitmap = image.bitmap(); | 50 const SkBitmap* image_bitmap = image.bitmap(); |
| 51 SkAutoLockPixels image_lock(*image_bitmap); | 51 SkAutoLockPixels image_lock(*image_bitmap); |
| 52 return *image_bitmap->getAddr32(0, 0) == expect; | 52 return *image_bitmap->getAddr32(0, 0) == expect; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 namespace ash { | 57 namespace ash { |
| 58 namespace internal { | |
| 59 | 58 |
| 60 class WallpaperResizerTest : public testing::Test, | 59 class WallpaperResizerTest : public testing::Test, |
| 61 public WallpaperResizerObserver { | 60 public WallpaperResizerObserver { |
| 62 public: | 61 public: |
| 63 WallpaperResizerTest() | 62 WallpaperResizerTest() |
| 64 : ui_thread_(content::BrowserThread::UI, &message_loop_) { | 63 : ui_thread_(content::BrowserThread::UI, &message_loop_) { |
| 65 } | 64 } |
| 66 virtual ~WallpaperResizerTest() {} | 65 virtual ~WallpaperResizerTest() {} |
| 67 | 66 |
| 68 gfx::ImageSkia Resize(const gfx::ImageSkia& image, | 67 gfx::ImageSkia Resize(const gfx::ImageSkia& image, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // both pre- and post-resize that matches the ID returned by GetImageId(). | 148 // both pre- and post-resize that matches the ID returned by GetImageId(). |
| 150 WallpaperResizer resizer(image, gfx::Size(10, 20), WALLPAPER_LAYOUT_STRETCH); | 149 WallpaperResizer resizer(image, gfx::Size(10, 20), WALLPAPER_LAYOUT_STRETCH); |
| 151 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); | 150 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); |
| 152 resizer.AddObserver(this); | 151 resizer.AddObserver(this); |
| 153 resizer.StartResize(); | 152 resizer.StartResize(); |
| 154 WaitForResize(); | 153 WaitForResize(); |
| 155 resizer.RemoveObserver(this); | 154 resizer.RemoveObserver(this); |
| 156 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); | 155 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); |
| 157 } | 156 } |
| 158 | 157 |
| 159 } // namespace internal | |
| 160 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |