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

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

Issue 102683004: Add mime type information to the download database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
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 // History unit tests come in two flavors: 5 // History unit tests come in two flavors:
6 // 6 //
7 // 1. The more complicated style is that the unit test creates a full history 7 // 1. The more complicated style is that the unit test creates a full history
8 // service. This spawns a background thread for the history backend, and 8 // service. This spawns a background thread for the history backend, and
9 // all communication is asynchronous. This is useful for testing more 9 // all communication is asynchronous. This is useful for testing more
10 // complicated things or end-to-end behavior. 10 // complicated things or end-to-end behavior.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool AddDownload(uint32 id, 163 bool AddDownload(uint32 id,
164 DownloadItem::DownloadState state, 164 DownloadItem::DownloadState state,
165 const Time& time) { 165 const Time& time) {
166 std::vector<GURL> url_chain; 166 std::vector<GURL> url_chain;
167 url_chain.push_back(GURL("foo-url")); 167 url_chain.push_back(GURL("foo-url"));
168 168
169 DownloadRow download(base::FilePath(FILE_PATH_LITERAL("current-path")), 169 DownloadRow download(base::FilePath(FILE_PATH_LITERAL("current-path")),
170 base::FilePath(FILE_PATH_LITERAL("target-path")), 170 base::FilePath(FILE_PATH_LITERAL("target-path")),
171 url_chain, 171 url_chain,
172 GURL("http://referrer.com/"), 172 GURL("http://referrer.com/"),
173 "application/octet-stream",
174 "application/octet-stream",
173 time, 175 time,
174 time, 176 time,
175 std::string(), 177 std::string(),
176 std::string(), 178 std::string(),
177 0, 179 0,
178 512, 180 512,
179 state, 181 state,
180 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 182 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
181 content::DOWNLOAD_INTERRUPT_REASON_NONE, 183 content::DOWNLOAD_INTERRUPT_REASON_NONE,
182 id, 184 id,
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 } 668 }
667 669
668 TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) { 670 TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) {
669 CreateBackendAndDatabase(); 671 CreateBackendAndDatabase();
670 base::Time now(base::Time::Now()); 672 base::Time now(base::Time::Now());
671 std::vector<GURL> url_chain; 673 std::vector<GURL> url_chain;
672 DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")), 674 DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")),
673 base::FilePath(FILE_PATH_LITERAL("foo-path")), 675 base::FilePath(FILE_PATH_LITERAL("foo-path")),
674 url_chain, 676 url_chain,
675 GURL(std::string()), 677 GURL(std::string()),
678 "application/octet-stream",
679 "application/octet-stream",
676 now, 680 now,
677 now, 681 now,
678 std::string(), 682 std::string(),
679 std::string(), 683 std::string(),
680 0, 684 0,
681 512, 685 512,
682 DownloadItem::COMPLETE, 686 DownloadItem::COMPLETE,
683 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 687 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
684 content::DOWNLOAD_INTERRUPT_REASON_NONE, 688 content::DOWNLOAD_INTERRUPT_REASON_NONE,
685 1, 689 1,
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 std::vector<PageUsageData*> results; 1884 std::vector<PageUsageData*> results;
1881 db_->QuerySegmentUsage(segment_time, 10, &results); 1885 db_->QuerySegmentUsage(segment_time, 10, &results);
1882 ASSERT_EQ(1u, results.size()); 1886 ASSERT_EQ(1u, results.size());
1883 EXPECT_EQ(url, results[0]->GetURL()); 1887 EXPECT_EQ(url, results[0]->GetURL());
1884 EXPECT_EQ(segment_id, results[0]->GetID()); 1888 EXPECT_EQ(segment_id, results[0]->GetID());
1885 EXPECT_EQ(title, results[0]->GetTitle()); 1889 EXPECT_EQ(title, results[0]->GetTitle());
1886 STLDeleteElements(&results); 1890 STLDeleteElements(&results);
1887 } 1891 }
1888 1892
1889 } // namespace history 1893 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698