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

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

Issue 10799005: Replace the DownloadFileManager with direct ownership (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 8 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
« no previous file with comments | « no previous file | content/browser/browser_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 if (info.download_info.show_download_item) 766 if (info.download_info.show_download_item)
767 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str(); 767 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str();
768 } 768 }
769 769
770 void DownloadInsertFilesErrorCheckErrors(size_t count, 770 void DownloadInsertFilesErrorCheckErrors(size_t count,
771 FileErrorInjectInfo* info) { 771 FileErrorInjectInfo* info) {
772 DownloadFilesCheckErrorsSetup(); 772 DownloadFilesCheckErrorsSetup();
773 773
774 // Set up file failures. 774 // Set up file failures.
775 scoped_refptr<content::TestFileErrorInjector> injector( 775 scoped_refptr<content::TestFileErrorInjector> injector(
776 content::TestFileErrorInjector::Create()); 776 content::TestFileErrorInjector::Create(
777 DownloadManagerForBrowser(browser())));
777 778
778 for (size_t i = 0; i < count; ++i) { 779 for (size_t i = 0; i < count; ++i) {
779 // Set up the full URL, for download file tracking. 780 // Set up the full URL, for download file tracking.
780 std::string server_path = "files/downloads/"; 781 std::string server_path = "files/downloads/";
781 server_path += info[i].download_info.url_name; 782 server_path += info[i].download_info.url_name;
782 GURL url = test_server()->GetURL(server_path); 783 GURL url = test_server()->GetURL(server_path);
783 info[i].error_info.url = url.spec(); 784 info[i].error_info.url = url.spec();
784 785
785 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); 786 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i);
786 } 787 }
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 GetDownloads(browser(), &download_items); 2462 GetDownloads(browser(), &download_items);
2462 ASSERT_EQ(1u, download_items.size()); 2463 ASSERT_EQ(1u, download_items.size());
2463 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2464 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
2464 download_items[0]->GetOriginalUrl()); 2465 download_items[0]->GetOriginalUrl());
2465 2466
2466 // Check that the file contains the expected referrer. 2467 // Check that the file contains the expected referrer.
2467 FilePath file(download_items[0]->GetFullPath()); 2468 FilePath file(download_items[0]->GetFullPath());
2468 std::string expected_contents = test_server()->GetURL("").spec(); 2469 std::string expected_contents = test_server()->GetURL("").spec();
2469 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); 2470 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length()));
2470 } 2471 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698