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

Side by Side Diff: chrome/browser/history/history_backend_unittest.cc

Issue 9030031: Move InMemoryURLIndex Caching Operations to FILE Thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Missed a private data swap. Try to fix update phase failure. Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 5 #include <set>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 IconMapping icon_mapping; 139 IconMapping icon_mapping;
140 if (backend_->thumbnail_db_->GetIconMappingForPageURL(url, icon_type, 140 if (backend_->thumbnail_db_->GetIconMappingForPageURL(url, icon_type,
141 &icon_mapping)) 141 &icon_mapping))
142 return icon_mapping.icon_id; 142 return icon_mapping.icon_id;
143 else 143 else
144 return 0; 144 return 0;
145 } 145 }
146 146
147 BookmarkModel bookmark_model_; 147 BookmarkModel bookmark_model_;
148 148
149 protected:
150 bool loaded_; 149 bool loaded_;
151 150
152 private: 151 private:
153 friend class HistoryBackendTestDelegate; 152 friend class HistoryBackendTestDelegate;
154 153
155 // testing::Test 154 // testing::Test
156 virtual void SetUp() { 155 virtual void SetUp() {
157 if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"), 156 if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"),
158 &test_dir_)) 157 &test_dir_))
159 return; 158 return;
160 backend_ = new HistoryBackend(test_dir_, 159 backend_ = new HistoryBackend(NULL,
160 test_dir_,
161 0, 161 0,
162 new HistoryBackendTestDelegate(this), 162 new HistoryBackendTestDelegate(this),
163 &bookmark_model_); 163 &bookmark_model_);
164 backend_->Init(std::string(), false); 164 backend_->Init(std::string(), false);
165 } 165 }
166 virtual void TearDown() { 166 virtual void TearDown() {
167 if (backend_.get()) 167 if (backend_.get())
168 backend_->Closing(); 168 backend_->Closing();
169 backend_ = NULL; 169 backend_ = NULL;
170 mem_backend_.reset(); 170 mem_backend_.reset();
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); 948 old_history_path = old_history_path.AppendASCII("HistoryNoSource");
949 949
950 // Copy history database file to current directory so that it will be deleted 950 // Copy history database file to current directory so that it will be deleted
951 // in Teardown. 951 // in Teardown.
952 FilePath new_history_path(getTestDir()); 952 FilePath new_history_path(getTestDir());
953 file_util::Delete(new_history_path, true); 953 file_util::Delete(new_history_path, true);
954 file_util::CreateDirectory(new_history_path); 954 file_util::CreateDirectory(new_history_path);
955 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename); 955 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename);
956 ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file)); 956 ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file));
957 957
958 backend_ = new HistoryBackend(new_history_path, 958 backend_ = new HistoryBackend(NULL,
959 new_history_path,
959 0, 960 0,
960 new HistoryBackendTestDelegate(this), 961 new HistoryBackendTestDelegate(this),
961 &bookmark_model_); 962 &bookmark_model_);
962 backend_->Init(std::string(), false); 963 backend_->Init(std::string(), false);
963 backend_->Closing(); 964 backend_->Closing();
964 backend_ = NULL; 965 backend_ = NULL;
965 966
966 // Now the database should already be migrated. 967 // Now the database should already be migrated.
967 // Check version first. 968 // Check version first.
968 int cur_version = HistoryDatabase::GetCurrentVersion(); 969 int cur_version = HistoryDatabase::GetCurrentVersion();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 // Same-domain cloning should work. 1160 // Same-domain cloning should work.
1160 backend_->CloneFavicon(url, same_domain_url); 1161 backend_->CloneFavicon(url, same_domain_url);
1161 EXPECT_TRUE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon)); 1162 EXPECT_TRUE(backend_->GetFaviconFromDB(same_domain_url, FAVICON, &favicon));
1162 1163
1163 // Foreign-domain cloning is forbidden. 1164 // Foreign-domain cloning is forbidden.
1164 backend_->CloneFavicon(url, foreign_domain_url); 1165 backend_->CloneFavicon(url, foreign_domain_url);
1165 EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url, 1166 EXPECT_FALSE(backend_->GetFaviconFromDB(foreign_domain_url,
1166 FAVICON, &favicon)); 1167 FAVICON, &favicon));
1167 } 1168 }
1168 } // namespace history 1169 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698