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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" |
7 #include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h" | 8 #include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h" |
8 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" | 9 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/scrollbar_size.h" | 15 #include "ui/gfx/scrollbar_size.h" |
15 | 16 |
16 namespace thumbnails { | 17 namespace thumbnails { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 base::MessageLoopForUI message_loop; | 151 base::MessageLoopForUI message_loop; |
151 content::TestBrowserThread ui_thread(content::BrowserThread::UI, | 152 content::TestBrowserThread ui_thread(content::BrowserThread::UI, |
152 &message_loop); | 153 &message_loop); |
153 ContentBasedThumbnailingAlgorithm::CreateRetargetedThumbnail( | 154 ContentBasedThumbnailingAlgorithm::CreateRetargetedThumbnail( |
154 source, | 155 source, |
155 thumbnail_size, | 156 thumbnail_size, |
156 context, | 157 context, |
157 base::Bind(&ConsumerCallbackCatcher::UiThreadCallback, | 158 base::Bind(&ConsumerCallbackCatcher::UiThreadCallback, |
158 base::Unretained(&catcher))); | 159 base::Unretained(&catcher))); |
159 message_loop.RunUntilIdle(); | 160 base::RunLoop().RunUntilIdle(); |
160 ASSERT_TRUE(catcher.called_back()); | 161 ASSERT_TRUE(catcher.called_back()); |
161 EXPECT_TRUE(catcher.score().good_clipping); | 162 EXPECT_TRUE(catcher.score().good_clipping); |
162 EXPECT_FALSE(catcher.captured_bitmap().empty()); | 163 EXPECT_FALSE(catcher.captured_bitmap().empty()); |
163 EXPECT_LT(catcher.captured_bitmap().width(), source.width()); | 164 EXPECT_LT(catcher.captured_bitmap().width(), source.width()); |
164 EXPECT_LT(catcher.captured_bitmap().height(), source.height()); | 165 EXPECT_LT(catcher.captured_bitmap().height(), source.height()); |
165 } | 166 } |
166 | 167 |
167 } // namespace thumbnails | 168 } // namespace thumbnails |
OLD | NEW |