Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: trunk/src/chrome/browser/history/thumbnail_database_unittest.cc

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "chrome/browser/history/history_database.h" 14 #include "chrome/browser/history/history_database.h"
15 #include "chrome/browser/history/history_unittest_base.h" 15 #include "chrome/browser/history/history_unittest_base.h"
16 #include "chrome/browser/history/thumbnail_database.h" 16 #include "chrome/browser/history/thumbnail_database.h"
17 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/thumbnail_score.h" 19 #include "chrome/common/thumbnail_score.h"
20 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
21 #include "chrome/tools/profiles/thumbnail-inl.h" 21 #include "chrome/tools/profiles/thumbnail-inl.h"
22 #include "content/public/test/test_browser_thread_bundle.h"
23 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
24 #include "third_party/skia/include/core/SkBitmap.h" 23 #include "third_party/skia/include/core/SkBitmap.h"
25 #include "ui/gfx/codec/jpeg_codec.h" 24 #include "ui/gfx/codec/jpeg_codec.h"
26 #include "url/gurl.h" 25 #include "url/gurl.h"
27 26
28 using base::Time; 27 using base::Time;
29 using base::TimeDelta; 28 using base::TimeDelta;
30 29
31 namespace history { 30 namespace history {
32 31
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 71
73 scoped_ptr<SkBitmap> google_bitmap_; 72 scoped_ptr<SkBitmap> google_bitmap_;
74 73
75 base::ScopedTempDir temp_dir_; 74 base::ScopedTempDir temp_dir_;
76 base::FilePath file_name_; 75 base::FilePath file_name_;
77 base::FilePath new_file_name_; 76 base::FilePath new_file_name_;
78 base::FilePath history_db_name_; 77 base::FilePath history_db_name_;
79 }; 78 };
80 79
81 class IconMappingMigrationTest : public HistoryUnitTestBase { 80 class IconMappingMigrationTest : public HistoryUnitTestBase {
81 public:
82 IconMappingMigrationTest() {
83 }
84 virtual ~IconMappingMigrationTest() {
85 }
86
82 protected: 87 protected:
83 virtual void SetUp() { 88 virtual void SetUp() {
89 profile_.reset(new TestingProfile);
90
84 base::FilePath data_path; 91 base::FilePath data_path;
85 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 92 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
86 data_path = data_path.AppendASCII("History"); 93 data_path = data_path.AppendASCII("History");
87 94
88 history_db_name_ = profile_.GetPath().Append(chrome::kHistoryFilename); 95 history_db_name_ = profile_->GetPath().Append(chrome::kHistoryFilename);
89 ASSERT_NO_FATAL_FAILURE( 96 ASSERT_NO_FATAL_FAILURE(
90 ExecuteSQLScript(data_path.AppendASCII("history.20.sql"), 97 ExecuteSQLScript(data_path.AppendASCII("history.20.sql"),
91 history_db_name_)); 98 history_db_name_));
92 thumbnail_db_name_ = 99 thumbnail_db_name_ =
93 profile_.GetPath().Append(chrome::kFaviconsFilename); 100 profile_->GetPath().Append(chrome::kFaviconsFilename);
94 ASSERT_NO_FATAL_FAILURE( 101 ASSERT_NO_FATAL_FAILURE(
95 ExecuteSQLScript(data_path.AppendASCII("thumbnails.3.sql"), 102 ExecuteSQLScript(data_path.AppendASCII("thumbnails.3.sql"),
96 thumbnail_db_name_)); 103 thumbnail_db_name_));
97 } 104 }
98 105
99 protected: 106 protected:
100 base::FilePath history_db_name_; 107 base::FilePath history_db_name_;
101 base::FilePath thumbnail_db_name_; 108 base::FilePath thumbnail_db_name_;
102 109
103 private: 110 private:
104 content::TestBrowserThreadBundle thread_bundle_; 111 scoped_ptr<TestingProfile> profile_;
105 TestingProfile profile_;
106 }; 112 };
107 113
108 TEST_F(ThumbnailDatabaseTest, AddIconMapping) { 114 TEST_F(ThumbnailDatabaseTest, AddIconMapping) {
109 ThumbnailDatabase db; 115 ThumbnailDatabase db;
110 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_, NULL, NULL)); 116 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_, NULL, NULL));
111 db.BeginTransaction(); 117 db.BeginTransaction();
112 118
113 std::vector<unsigned char> data(blob1, blob1 + sizeof(blob1)); 119 std::vector<unsigned char> data(blob1, blob1 + sizeof(blob1));
114 scoped_refptr<base::RefCountedBytes> favicon(new base::RefCountedBytes(data)); 120 scoped_refptr<base::RefCountedBytes> favicon(new base::RefCountedBytes(data));
115 121
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 EXPECT_EQ(touch_mapping_id1, icon_mapping.mapping_id); 852 EXPECT_EQ(touch_mapping_id1, icon_mapping.mapping_id);
847 EXPECT_EQ(url, icon_mapping.page_url); 853 EXPECT_EQ(url, icon_mapping.page_url);
848 EXPECT_EQ(touch_icon_id1, icon_mapping.icon_id); 854 EXPECT_EQ(touch_icon_id1, icon_mapping.icon_id);
849 EXPECT_EQ(icon_url1, icon_mapping.icon_url); 855 EXPECT_EQ(icon_url1, icon_mapping.icon_url);
850 EXPECT_EQ(chrome::TOUCH_ICON, icon_mapping.icon_type); 856 EXPECT_EQ(chrome::TOUCH_ICON, icon_mapping.icon_type);
851 857
852 EXPECT_FALSE(enumerator2.GetNextIconMapping(&icon_mapping)); 858 EXPECT_FALSE(enumerator2.GetNextIconMapping(&icon_mapping));
853 } 859 }
854 860
855 } // namespace history 861 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698