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 "chrome/browser/thumbnails/content_analysis.h" | 5 #include "chrome/browser/thumbnails/content_analysis.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <limits> | 10 #include <limits> |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 source, gfx::Size(424, 264), 2.5); | 463 source, gfx::Size(424, 264), 2.5); |
464 EXPECT_FALSE(result.empty()); | 464 EXPECT_FALSE(result.empty()); |
465 | 465 |
466 // Given the nature of computation We can't really assert much here about the | 466 // Given the nature of computation We can't really assert much here about the |
467 // image itself. We know it should have been computed, should be smaller than | 467 // image itself. We know it should have been computed, should be smaller than |
468 // the original and it must not be zero. | 468 // the original and it must not be zero. |
469 EXPECT_LT(result.width(), image_size.width()); | 469 EXPECT_LT(result.width(), image_size.width()); |
470 EXPECT_LT(result.height(), image_size.height()); | 470 EXPECT_LT(result.height(), image_size.height()); |
471 // TODO(motek): this test is problematic/flaky on Win7. Investigate. | 471 // TODO(motek): this test is problematic/flaky on Win7. Investigate. |
472 #if !defined(OS_WIN) | 472 #if !defined(OS_WIN) |
473 int histogram[256]; | 473 int histogram[256] = {}; |
474 color_utils::BuildLumaHistogram(result, histogram); | 474 color_utils::BuildLumaHistogram(result, histogram); |
475 int non_zero_color_count = std::count_if( | 475 int non_zero_color_count = std::count_if( |
476 histogram, histogram + 256, std::bind2nd(std::greater<int>(), 0)); | 476 histogram, histogram + 256, std::bind2nd(std::greater<int>(), 0)); |
477 EXPECT_GT(non_zero_color_count, 4); | 477 EXPECT_GT(non_zero_color_count, 4); |
478 #endif // !defined(OS_WIN) | 478 #endif // !defined(OS_WIN) |
479 } | 479 } |
480 | 480 |
481 } // namespace thumbnailing_utils | 481 } // namespace thumbnailing_utils |
OLD | NEW |