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

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

Issue 10823406: Remove DownloadFileManager in favor of direct ownership of DownloadFiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments and 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 | chrome/browser/download/save_page_browsertest.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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 if (info.download_info.show_download_item) 771 if (info.download_info.show_download_item)
772 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str(); 772 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str();
773 } 773 }
774 774
775 void DownloadInsertFilesErrorCheckErrors(size_t count, 775 void DownloadInsertFilesErrorCheckErrors(size_t count,
776 FileErrorInjectInfo* info) { 776 FileErrorInjectInfo* info) {
777 DownloadFilesCheckErrorsSetup(); 777 DownloadFilesCheckErrorsSetup();
778 778
779 // Set up file failures. 779 // Set up file failures.
780 scoped_refptr<content::TestFileErrorInjector> injector( 780 scoped_refptr<content::TestFileErrorInjector> injector(
781 content::TestFileErrorInjector::Create()); 781 content::TestFileErrorInjector::Create(
782 DownloadManagerForBrowser(browser())));
782 783
783 for (size_t i = 0; i < count; ++i) { 784 for (size_t i = 0; i < count; ++i) {
784 // Set up the full URL, for download file tracking. 785 // Set up the full URL, for download file tracking.
785 std::string server_path = "files/downloads/"; 786 std::string server_path = "files/downloads/";
786 server_path += info[i].download_info.url_name; 787 server_path += info[i].download_info.url_name;
787 GURL url = test_server()->GetURL(server_path); 788 GURL url = test_server()->GetURL(server_path);
788 info[i].error_info.url = url.spec(); 789 info[i].error_info.url = url.spec();
789 790
790 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); 791 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i);
791 } 792 }
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 GetDownloads(browser(), &download_items); 2470 GetDownloads(browser(), &download_items);
2470 ASSERT_EQ(1u, download_items.size()); 2471 ASSERT_EQ(1u, download_items.size());
2471 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2472 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
2472 download_items[0]->GetOriginalUrl()); 2473 download_items[0]->GetOriginalUrl());
2473 2474
2474 // Check that the file contains the expected referrer. 2475 // Check that the file contains the expected referrer.
2475 FilePath file(download_items[0]->GetFullPath()); 2476 FilePath file(download_items[0]->GetFullPath());
2476 std::string expected_contents = test_server()->GetURL("").spec(); 2477 std::string expected_contents = test_server()->GetURL("").spec();
2477 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); 2478 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length()));
2478 } 2479 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698