| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h" |
| 5 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 6 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 8 #include "base/gfx/jpeg_codec.h" | |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/history/thumbnail_database.h" | 10 #include "chrome/browser/history/thumbnail_database.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/thumbnail_score.h" | 12 #include "chrome/common/thumbnail_score.h" |
| 13 #include "chrome/tools/profiles/thumbnail-inl.h" | 13 #include "chrome/tools/profiles/thumbnail-inl.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 17 | 17 |
| 18 using base::Time; | 18 using base::Time; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 protected: | 48 protected: |
| 49 // testing::Test | 49 // testing::Test |
| 50 virtual void SetUp() { | 50 virtual void SetUp() { |
| 51 // get an empty file for the test DB | 51 // get an empty file for the test DB |
| 52 FilePath test_data_dir; | 52 FilePath test_data_dir; |
| 53 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 53 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
| 54 file_name_ = test_data_dir.AppendASCII("TestThumbnails.db"); | 54 file_name_ = test_data_dir.AppendASCII("TestThumbnails.db"); |
| 55 file_util::Delete(file_name_, false); | 55 file_util::Delete(file_name_, false); |
| 56 | 56 |
| 57 google_bitmap_.reset( | 57 google_bitmap_.reset( |
| 58 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); | 58 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void TearDown() { | 61 virtual void TearDown() { |
| 62 file_util::Delete(file_name_, false); | 62 file_util::Delete(file_name_, false); |
| 63 } | 63 } |
| 64 | 64 |
| 65 scoped_ptr<SkBitmap> google_bitmap_; | 65 scoped_ptr<SkBitmap> google_bitmap_; |
| 66 | 66 |
| 67 FilePath file_name_; | 67 FilePath file_name_; |
| 68 }; | 68 }; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 ThumbnailScore totally_boring_in_the_future( | 323 ThumbnailScore totally_boring_in_the_future( |
| 324 kTotallyBoring, true, true, kNow + TimeDelta::FromDays(365)); | 324 kTotallyBoring, true, true, kNow + TimeDelta::FromDays(365)); |
| 325 db.SetPageThumbnail(gurl, kPage1, *google_bitmap_, | 325 db.SetPageThumbnail(gurl, kPage1, *google_bitmap_, |
| 326 totally_boring_in_the_future, time); | 326 totally_boring_in_the_future, time); |
| 327 ASSERT_TRUE(db.GetPageThumbnail(kPage1, &jpeg_data)); | 327 ASSERT_TRUE(db.GetPageThumbnail(kPage1, &jpeg_data)); |
| 328 ASSERT_TRUE(db.ThumbnailScoreForId(kPage1, &score_out)); | 328 ASSERT_TRUE(db.ThumbnailScoreForId(kPage1, &score_out)); |
| 329 ASSERT_TRUE(base_boring.Equals(score_out)); | 329 ASSERT_TRUE(base_boring.Equals(score_out)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace history | 332 } // namespace history |
| OLD | NEW |