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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "components/wallpaper/wallpaper_resizer.h" | 6 #include "components/wallpaper/wallpaper_resizer.h" |
7 #include "components/wallpaper/wallpaper_resizer_observer.h" | 7 #include "components/wallpaper/wallpaper_resizer_observer.h" |
8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/image/image_skia_rep.h" | 10 #include "ui/gfx/image/image_skia_rep.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 image, target_size, layout, content::BrowserThread::GetBlockingPool())); | 67 image, target_size, layout, content::BrowserThread::GetBlockingPool())); |
68 resizer->AddObserver(this); | 68 resizer->AddObserver(this); |
69 resizer->StartResize(); | 69 resizer->StartResize(); |
70 WaitForResize(); | 70 WaitForResize(); |
71 resizer->RemoveObserver(this); | 71 resizer->RemoveObserver(this); |
72 return resizer->image(); | 72 return resizer->image(); |
73 } | 73 } |
74 | 74 |
75 void WaitForResize() { message_loop_.Run(); } | 75 void WaitForResize() { message_loop_.Run(); } |
76 | 76 |
77 void OnWallpaperResized() override { message_loop_.Quit(); } | 77 void OnWallpaperResized() override { message_loop_.QuitWhenIdle(); } |
78 | 78 |
79 private: | 79 private: |
80 base::MessageLoop message_loop_; | 80 base::MessageLoop message_loop_; |
81 content::TestBrowserThread ui_thread_; | 81 content::TestBrowserThread ui_thread_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(WallpaperResizerTest); | 83 DISALLOW_COPY_AND_ASSIGN(WallpaperResizerTest); |
84 }; | 84 }; |
85 | 85 |
86 TEST_F(WallpaperResizerTest, BasicResize) { | 86 TEST_F(WallpaperResizerTest, BasicResize) { |
87 // Keeps in sync with WallpaperLayout enum. | 87 // Keeps in sync with WallpaperLayout enum. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 content::BrowserThread::GetBlockingPool()); | 142 content::BrowserThread::GetBlockingPool()); |
143 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); | 143 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); |
144 resizer.AddObserver(this); | 144 resizer.AddObserver(this); |
145 resizer.StartResize(); | 145 resizer.StartResize(); |
146 WaitForResize(); | 146 WaitForResize(); |
147 resizer.RemoveObserver(this); | 147 resizer.RemoveObserver(this); |
148 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); | 148 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); |
149 } | 149 } |
150 | 150 |
151 } // namespace ash | 151 } // namespace ash |
OLD | NEW |