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

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Applied Pawel's comments Created 9 years, 4 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/i18n/file_util_icu.h"
7 #include "base/path_service.h" 8 #include "base/path_service.h"
8 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/download/download_history.h" 13 #include "chrome/browser/download/download_history.h"
11 #include "chrome/browser/download/download_item.h" 14 #include "chrome/browser/download/download_item.h"
12 #include "chrome/browser/download/download_manager.h" 15 #include "chrome/browser/download/download_manager.h"
13 #include "chrome/browser/history/download_history_info.h" 16 #include "chrome/browser/history/download_history_info.h"
17 #include "chrome/browser/download/download_prefs.h"
18 #include "chrome/browser/download/download_util.h"
19 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/webui/active_downloads_ui.h" 23 #include "chrome/browser/ui/webui/active_downloads_ui.h"
18 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/pref_names.h"
26 #include "chrome/common/random.h"
19 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/in_process_browser_test.h" 28 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/ui_test_utils.h" 29 #include "chrome/test/base/ui_test_utils.h"
22 #include "content/browser/net/url_request_mock_http_job.h" 30 #include "content/browser/net/url_request_mock_http_job.h"
23 #include "content/browser/tab_contents/tab_contents.h" 31 #include "content/browser/tab_contents/tab_contents.h"
24 #include "content/common/content_notification_types.h" 32 #include "content/common/content_notification_types.h"
25 #include "content/common/notification_service.h" 33 #include "content/common/notification_service.h"
34 #include "net/url_request/url_request_filter.h"
26 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
27 36
28 namespace { 37 namespace {
29 38
30 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page"); 39 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page");
31 40
41 // The test file used in SavePageBrowserTest.SaveFolder3.
42 static const FilePath kTestFile(FILE_PATH_LITERAL("a.htm"));
43
32 static const char* kAppendedExtension = 44 static const char* kAppendedExtension =
33 #if defined(OS_WIN) 45 #if defined(OS_WIN)
34 ".htm"; 46 ".htm";
35 #else 47 #else
36 ".html"; 48 ".html";
37 #endif 49 #endif
38 50
39 class SavePageBrowserTest : public InProcessBrowserTest { 51 class SavePageBrowserTest : public InProcessBrowserTest {
40 protected: 52 protected:
41 void SetUp() { 53 void SetUp() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 found = true; 86 found = true;
75 break; 87 break;
76 } 88 }
77 } 89 }
78 EXPECT_TRUE(found); 90 EXPECT_TRUE(found);
79 #else 91 #else
80 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 92 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
81 #endif 93 #endif
82 } 94 }
83 95
96 // Changes the default folder prefs. This method saves the current folder
97 // for saving HTML, the current folder for saving downloaded files,
98 // the current user's "Downloads" folder and a save type (HTML only or
99 // complete HTML files), and then changes them to |website_save_dir|,
100 // |download_save_dir| and |save_type|, respectively.
101 // If we call this method, we must call RestoreDirectoryPrefs()
102 // after the test to restore the default folder prefs.
103 void ChangeDirectoryPrefs(
104 Profile* profile,
105 const FilePath& website_save_dir,
106 const FilePath& download_save_dir,
107 const SavePackage::SavePackageType save_type) {
108 DCHECK(profile);
109 PrefService* prefs = profile->GetPrefs();
110
111 ASSERT_TRUE(prefs->FindPreference(prefs::kDownloadDefaultDirectory));
112 prev_download_save_dir_ = prefs->GetFilePath(
113 prefs::kDownloadDefaultDirectory);
114
115 // Check whether the preference has the default folder for saving HTML.
116 // If not, initialize it with the default folder for downloaded files.
117 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) {
118 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
119 prev_download_save_dir_,
120 PrefService::UNSYNCABLE_PREF);
121 }
122 prev_website_save_dir_ = prefs->GetFilePath(
123 prefs::kSaveFileDefaultDirectory);
124
125 DownloadPrefs* download_prefs =
126 profile->GetDownloadManager()->download_prefs();
127 prev_save_type_ =
128 static_cast<SavePackage::SavePackageType>
129 (download_prefs->save_file_type());
130
131 prefs->SetFilePath(
132 prefs::kSaveFileDefaultDirectory, website_save_dir);
133 prefs->SetFilePath(
134 prefs::kDownloadDefaultDirectory, download_save_dir);
135 prefs->SetInteger(prefs::kSaveFileType, save_type);
136 }
137
138 // Restores the default folder prefs.
139 void RestoreDirectoryPrefs(Profile* profile) {
140 DCHECK(profile);
141 PrefService* prefs = profile->GetPrefs();
142 prefs->SetFilePath(
143 prefs::kSaveFileDefaultDirectory, prev_website_save_dir_);
144 prefs->SetFilePath(
145 prefs::kDownloadDefaultDirectory, prev_download_save_dir_);
146 prefs->SetInteger(prefs::kSaveFileType, prev_save_type_);
147 }
148
84 DownloadManager* GetDownloadManager() const { 149 DownloadManager* GetDownloadManager() const {
85 DownloadManager* download_manager = 150 DownloadManager* download_manager =
86 browser()->profile()->GetDownloadManager(); 151 browser()->profile()->GetDownloadManager();
87 EXPECT_TRUE(download_manager); 152 EXPECT_TRUE(download_manager);
88 return download_manager; 153 return download_manager;
89 } 154 }
90 155
91 void QueryDownloadHistory() { 156 void QueryDownloadHistory() {
92 // Query the history system. 157 // Query the history system.
93 GetDownloadManager()->download_history()->Load( 158 GetDownloadManager()->download_history()->Load(
94 NewCallback(this, 159 NewCallback(this,
95 &SavePageBrowserTest::OnQueryDownloadEntriesComplete)); 160 &SavePageBrowserTest::OnQueryDownloadEntriesComplete));
96 161
97 // Run message loop until a quit message is sent from 162 // Run message loop until a quit message is sent from
98 // OnQueryDownloadEntriesComplete(). 163 // OnQueryDownloadEntriesComplete().
99 ui_test_utils::RunMessageLoop(); 164 ui_test_utils::RunMessageLoop();
100 } 165 }
101 166
102 void OnQueryDownloadEntriesComplete( 167 void OnQueryDownloadEntriesComplete(
103 std::vector<DownloadHistoryInfo>* entries) { 168 std::vector<DownloadHistoryInfo>* entries) {
104 history_entries_ = *entries; 169 history_entries_ = *entries;
105 170
106 // Indicate thet we have received the history and can continue. 171 // Indicate thet we have received the history and can continue.
107 MessageLoopForUI::current()->Quit(); 172 MessageLoopForUI::current()->Quit();
108 } 173 }
109 174
175 // Returns "src/chrome/test/data/{kTestFile}", whatever URL is given.
176 static net::URLRequestJob* FactoryForTestFile(
177 net::URLRequest* request, const std::string& scheme) {
178 FilePath test_dir;
179 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
180 return new URLRequestMockHTTPJob(
181 request, test_dir.Append(kTestDir).Append(kTestFile));
182 }
183
110 struct DownloadHistoryInfoMatch 184 struct DownloadHistoryInfoMatch
111 : public std::unary_function<DownloadHistoryInfo, bool> { 185 : public std::unary_function<DownloadHistoryInfo, bool> {
112 186
113 DownloadHistoryInfoMatch(const GURL& url, 187 DownloadHistoryInfoMatch(const GURL& url,
114 const FilePath& path, 188 const FilePath& path,
115 int64 num_files) 189 int64 num_files)
116 : url_(url), 190 : url_(url),
117 path_(path), 191 path_(path),
118 num_files_(num_files) { 192 num_files_(num_files) {
119 } 193 }
(...skipping 22 matching lines...) Expand all
142 history_entries_.end()); 216 history_entries_.end());
143 } 217 }
144 218
145 std::vector<DownloadHistoryInfo> history_entries_; 219 std::vector<DownloadHistoryInfo> history_entries_;
146 220
147 // Path to directory containing test data. 221 // Path to directory containing test data.
148 FilePath test_dir_; 222 FilePath test_dir_;
149 223
150 // Temporary directory we will save pages to. 224 // Temporary directory we will save pages to.
151 ScopedTempDir save_dir_; 225 ScopedTempDir save_dir_;
226
227 // Temporarily stores the default folder prefs.
228 FilePath prev_website_save_dir_;
229 FilePath prev_download_save_dir_;
230 SavePackage::SavePackageType prev_save_type_;
152 }; 231 };
153 232
233 } // namespace
234
154 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnly) { 235 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnly) {
155 FilePath file_name(FILE_PATH_LITERAL("a.htm")); 236 FilePath file_name(FILE_PATH_LITERAL("a.htm"));
156 GURL url = URLRequestMockHTTPJob::GetMockUrl( 237 GURL url = URLRequestMockHTTPJob::GetMockUrl(
157 FilePath(kTestDir).Append(file_name)); 238 FilePath(kTestDir).Append(file_name));
158 ui_test_utils::NavigateToURL(browser(), url); 239 ui_test_utils::NavigateToURL(browser(), url);
159 240
160 TabContents* current_tab = browser()->GetSelectedTabContents(); 241 TabContents* current_tab = browser()->GetSelectedTabContents();
161 ASSERT_TRUE(current_tab); 242 ASSERT_TRUE(current_tab);
162 243
163 FilePath full_file_name = save_dir_.path().Append(file_name); 244 FilePath full_file_name = save_dir_.path().Append(file_name);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 test_dir_.Append(FilePath(kTestDir)).AppendASCII("b.saved1.htm"), 312 test_dir_.Append(FilePath(kTestDir)).AppendASCII("b.saved1.htm"),
232 full_file_name)); 313 full_file_name));
233 EXPECT_TRUE(file_util::ContentsEqual( 314 EXPECT_TRUE(file_util::ContentsEqual(
234 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), 315 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"),
235 dir.AppendASCII("1.png"))); 316 dir.AppendASCII("1.png")));
236 EXPECT_TRUE(file_util::ContentsEqual( 317 EXPECT_TRUE(file_util::ContentsEqual(
237 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), 318 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"),
238 dir.AppendASCII("1.css"))); 319 dir.AppendASCII("1.css")));
239 } 320 }
240 321
322 // Checks if an HTML page is saved to the default folder for saving HTML
323 // in the following situation:
324 // The default folder for saving HTML exists.
325 // The default folder for downloaded files exists.
326 // The user's "Downloads" folder exists.
327 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveFolder1) {
328 FilePath file(FILE_PATH_LITERAL("a.htm"));
329 GURL url = URLRequestMockHTTPJob::GetMockUrl(
330 FilePath(kTestDir).Append(file));
331 ui_test_utils::NavigateToURL(browser(), url);
332
333 TabContents* current_tab = browser()->GetSelectedTabContents();
334 ASSERT_TRUE(current_tab);
335 ASSERT_TRUE(browser()->profile());
336
337 ScopedTempDir website_save_dir, download_save_dir;
338 // Prepare the default folder for saving HTML.
339 ASSERT_TRUE(website_save_dir.CreateUniqueTempDir());
340 // Prepare the default folder for downloaded files.
341 ASSERT_TRUE(download_save_dir.CreateUniqueTempDir());
342
343 // Changes the default prefs.
344 ChangeDirectoryPrefs(
345 browser()->profile(),
346 website_save_dir.path(),
347 download_save_dir.path(),
348 SavePackage::SAVE_AS_ONLY_HTML);
349
350 string16 title = current_tab->SavePageBasedOnDefaultPrefs();
351 FilePath::StringType basename;
352 #if defined(OS_WIN)
353 basename = UTF16ToWide(title);
354 basename.append(FILE_PATH_LITERAL(".htm"));
355 #else
356 basename = UTF16ToASCII(title);
357 basename.append(FILE_PATH_LITERAL(".html"));
358 #endif
359 file_util::ReplaceIllegalCharactersInPath(&basename, ' ');
360 FilePath downloaded_file = website_save_dir.path().Append(FilePath(basename));
361
362 EXPECT_EQ(url, WaitForSavePackageToFinish());
363
364 CheckDownloadUI(downloaded_file);
365
366 // Is the file downloaded to the default folder for saving HTML?
367 EXPECT_TRUE(file_util::PathExists(downloaded_file));
368 EXPECT_TRUE(file_util::ContentsEqual(
369 test_dir_.Append(FilePath(kTestDir)).Append(file),
370 downloaded_file));
371
372 RestoreDirectoryPrefs(browser()->profile());
373 }
374
375 // Checks if an HTML page is saved to the default folder for downloaded files
376 // in the following situation:
377 // The default folder for saving HTML does not exist.
378 // The default folder for downloaded files exists.
379 // The user's "Downloads" folder exists.
380 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveFolder2) {
381 FilePath file(FILE_PATH_LITERAL("a.htm"));
382 GURL url = URLRequestMockHTTPJob::GetMockUrl(
383 FilePath(kTestDir).Append(file));
384 ui_test_utils::NavigateToURL(browser(), url);
385
386 TabContents* current_tab = browser()->GetSelectedTabContents();
387 ASSERT_TRUE(current_tab);
388 ASSERT_TRUE(browser()->profile());
389
390 ScopedTempDir download_save_dir;
391 // Prepare the default folder for saving downloaded files.
392 ASSERT_TRUE(download_save_dir.CreateUniqueTempDir());
393 // Prepare non-existent folder.
394 FilePath nonexistent_path(
395 FILE_PATH_LITERAL("/tmp/koakuma_mikity_moemoe_nyannyan"));
396 ASSERT_FALSE(file_util::PathExists(nonexistent_path));
397
398 // Changes the default prefs.
399 ChangeDirectoryPrefs(
400 browser()->profile(),
401 nonexistent_path,
402 download_save_dir.path(),
403 SavePackage::SAVE_AS_ONLY_HTML);
404
405 string16 title = current_tab->SavePageBasedOnDefaultPrefs();
406 FilePath::StringType basename;
407 #if defined(OS_WIN)
408 basename = UTF16ToWide(title);
409 basename.append(FILE_PATH_LITERAL(".htm"));
410 #else
411 basename = UTF16ToASCII(title);
412 basename.append(FILE_PATH_LITERAL(".html"));
413 #endif
414 file_util::ReplaceIllegalCharactersInPath(&basename, ' ');
415 FilePath downloaded_file =
416 download_save_dir.path().Append(FilePath(basename));
417
418 EXPECT_EQ(url, WaitForSavePackageToFinish());
419
420 CheckDownloadUI(downloaded_file);
421
422 // Is the file downloaded to the default folder for downloaded files?
423 EXPECT_TRUE(file_util::PathExists(downloaded_file));
424 EXPECT_FALSE(file_util::PathExists(nonexistent_path));
425 EXPECT_TRUE(file_util::ContentsEqual(
426 test_dir_.Append(FilePath(kTestDir)).Append(file),
427 downloaded_file));
428
429 RestoreDirectoryPrefs(browser()->profile());
430 }
431
432 // Checks if an HTML page is saved to the user's "Downloads" folder
433 // in the following situation:
434 // The default folder for saving HTML does not exist.
435 // The default folder for downloaded files does not exist.
436 // The user's "Downloads" folder exists.
437 //
438 // This test creates and deletes a file on the user's real "Downloads" folder,
439 // which is globally shared among all tests on the testing environment.
440 // Therefore, if we run browser tests in parallel, the file created by one
441 // browser test may be deleted by another broswer test when the file name
442 // conflicts. In order to avoid this problem, we use a special mock URL
443 // "http://mock.testfile.http/<random path>" for this download test.
444 // Since we redirect "http://mock.testfile.http/<random path>" to
445 // "chrome/test/data/{kTestFile}" using FactoryForTestFile(),
446 // "chrome/test/data/{kTestFile}" is used for the file to be downloaded.
447 // Then, the downloaded file is saved as a name "Downloads/<random path>",
448 // which is a unique file name in the user's real "Downloads" folder.
449 //
450 // Ideally, in the first place, we should not use the user's "Downloads" folder.
451 // Instead, we should create a temporary "Downloads" folder for each test.
452 // However, we concluded that creating temporary "Downloads" folder for each
453 // test requires very invasive code changes to many places. See also here:
454 // http://codereview.chromium.org/6973052/
455 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveFolder3) {
456 FilePath file(kTestFile);
457
458 // Redirects "http://mock.testfile.http/<random path>"
459 // to "src/chrome/test/data/{kTestFile}", whatever the <random path> is.
460 std::string kMockHostnameForTestFile = "mock.testfile.http";
461 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
462 filter->AddHostnameHandler(
463 "http", kMockHostnameForTestFile, FactoryForTestFile);
464 std::string random_string = Generate128BitRandomBase64String();
465 RemoveChars(random_string, "/", &random_string);
466 GURL url("http://" + kMockHostnameForTestFile + "/" + random_string);
467 ui_test_utils::NavigateToURL(browser(), url);
468
469 TabContents* current_tab = browser()->GetSelectedTabContents();
470 ASSERT_TRUE(current_tab);
471 ASSERT_TRUE(browser()->profile());
472
473 // Prepare non-existent folder.
474 FilePath nonexistent_path1(
475 FILE_PATH_LITERAL("/tmp/koakuma_mikity_moemoe_nyannyan"));
476 FilePath nonexistent_path2(
477 FILE_PATH_LITERAL("/tmp/koakuma_mikity_moemoe_pyonpyon"));
478 ASSERT_FALSE(file_util::PathExists(nonexistent_path1));
479 ASSERT_FALSE(file_util::PathExists(nonexistent_path2));
480
481 // Changes the default prefs.
482 ChangeDirectoryPrefs(
483 browser()->profile(),
484 nonexistent_path1,
485 nonexistent_path2,
486 SavePackage::SAVE_AS_ONLY_HTML);
487
488 string16 title = current_tab->SavePageBasedOnDefaultPrefs();
489 FilePath::StringType basename;
490 #if defined(OS_WIN)
491 basename = UTF16ToWide(title);
492 basename.append(FILE_PATH_LITERAL(".htm"));
493 #else
494 basename = UTF16ToASCII(title);
495 basename.append(FILE_PATH_LITERAL(".html"));
496 #endif
497 file_util::ReplaceIllegalCharactersInPath(&basename, ' ');
498 FilePath default_download_dir =
499 download_util::GetDefaultDownloadDirectoryFromPathService();
500 FilePath downloaded_file =
501 default_download_dir.Append(FilePath(basename));
502 // Make sure that the target file does not exist.
503 // This fails when the file does not exist, but it is OK.
504 file_util::Delete(downloaded_file, false);
505 // Make sure that the temporary file does not exist.
506 FilePath temporary_file =
507 default_download_dir.Append(FilePath(
508 basename + FILE_PATH_LITERAL(".crdownload")));
509 // This fails when the file does not exist, but it is OK.
510 file_util::Delete(temporary_file, false);
511
512 EXPECT_EQ(url, WaitForSavePackageToFinish());
513
514 CheckDownloadUI(downloaded_file);
515
516 // Is the file downloaded to the user's "Downloads" directory?
517 EXPECT_TRUE(file_util::PathExists(downloaded_file));
518 EXPECT_FALSE(file_util::PathExists(nonexistent_path1));
519 EXPECT_FALSE(file_util::PathExists(nonexistent_path2));
520 EXPECT_TRUE(file_util::ContentsEqual(
521 test_dir_.Append(FilePath(kTestDir)).Append(file), downloaded_file));
522
523 // Clean up the generated files.
524 ASSERT_TRUE(file_util::Delete(downloaded_file, false));
525 ASSERT_TRUE(file_util::Delete(temporary_file, false));
526
527 RestoreDirectoryPrefs(browser()->profile());
528 }
529
241 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { 530 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) {
242 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); 531 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
243 ASSERT_TRUE(browser()->command_updater()->SupportsCommand(IDC_SAVE_PAGE)); 532 ASSERT_TRUE(browser()->command_updater()->SupportsCommand(IDC_SAVE_PAGE));
244 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE)); 533 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE));
245 } 534 }
246 535
247 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { 536 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) {
248 FilePath file_name(FILE_PATH_LITERAL("b.htm")); 537 FilePath file_name(FILE_PATH_LITERAL("b.htm"));
249 538
250 GURL url = URLRequestMockHTTPJob::GetMockUrl( 539 GURL url = URLRequestMockHTTPJob::GetMockUrl(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 EXPECT_EQ(std::find_if(history_entries_.begin(), history_entries_.end(), 599 EXPECT_EQ(std::find_if(history_entries_.begin(), history_entries_.end(),
311 DownloadHistoryInfoMatch(url, full_file_name, 1)), 600 DownloadHistoryInfoMatch(url, full_file_name, 1)),
312 history_entries_.end()); 601 history_entries_.end());
313 602
314 EXPECT_TRUE(file_util::PathExists(full_file_name)); 603 EXPECT_TRUE(file_util::PathExists(full_file_name));
315 EXPECT_FALSE(file_util::PathExists(dir)); 604 EXPECT_FALSE(file_util::PathExists(dir));
316 EXPECT_TRUE(file_util::ContentsEqual( 605 EXPECT_TRUE(file_util::ContentsEqual(
317 test_dir_.Append(FilePath(kTestDir)).Append(file_name), 606 test_dir_.Append(FilePath(kTestDir)).Append(file_name),
318 full_file_name)); 607 full_file_name));
319 } 608 }
320
321 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/ui/webui/options/advanced_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698