OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "chrome/browser/history/top_sites.h" | 7 #include "chrome/browser/history/top_sites.h" |
8 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 8 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
11 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
12 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
13 #include "content/test/mock_render_process_host.h" | 13 #include "content/test/mock_render_process_host.h" |
14 #include "content/test/test_renderer_host.h" | 14 #include "content/test/test_renderer_host.h" |
15 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/skia/include/core/SkColorPriv.h" | 17 #include "third_party/skia/include/core/SkColorPriv.h" |
18 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/surface/transport_dib.h" | 19 #include "ui/surface/transport_dib.h" |
20 | 20 |
21 using content::WebContents; | 21 using content::WebContents; |
22 | 22 |
23 typedef testing::Test ThumbnailGeneratorTest; | 23 typedef testing::Test ThumbnailGeneratorTest; |
24 | 24 |
25 TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_Empty) { | 25 TEST_F(ThumbnailGeneratorTest, CalculateBoringScore_Empty) { |
26 SkBitmap bitmap; | 26 SkBitmap bitmap; |
27 EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(bitmap)); | 27 EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(bitmap)); |
28 } | 28 } |
29 | 29 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 good_score.good_clipping = true; | 232 good_score.good_clipping = true; |
233 good_score.boring_score = 0.0; | 233 good_score.boring_score = 0.0; |
234 good_score.load_completed = true; | 234 good_score.load_completed = true; |
235 top_sites->AddKnownURL(kGoodURL, good_score); | 235 top_sites->AddKnownURL(kGoodURL, good_score); |
236 | 236 |
237 // Should be false, as the existing thumbnail is good enough (i.e. don't | 237 // Should be false, as the existing thumbnail is good enough (i.e. don't |
238 // need to replace the existing thumbnail which is new and good). | 238 // need to replace the existing thumbnail which is new and good). |
239 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 239 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
240 &profile, top_sites.get(), kGoodURL)); | 240 &profile, top_sites.get(), kGoodURL)); |
241 } | 241 } |
OLD | NEW |