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

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

Issue 640353003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 2 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 #define MAYBE_SaveHTMLOnlyTabDestroy DISABLED_SaveHTMLOnlyTabDestroy 460 #define MAYBE_SaveHTMLOnlyTabDestroy DISABLED_SaveHTMLOnlyTabDestroy
461 #else 461 #else
462 #define MAYBE_SaveHTMLOnlyTabDestroy SaveHTMLOnlyTabDestroy 462 #define MAYBE_SaveHTMLOnlyTabDestroy SaveHTMLOnlyTabDestroy
463 #endif 463 #endif
464 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnlyTabDestroy) { 464 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnlyTabDestroy) {
465 GURL url = NavigateToMockURL("a"); 465 GURL url = NavigateToMockURL("a");
466 scoped_ptr<DelayingDownloadManagerDelegate> delaying_delegate( 466 scoped_ptr<DelayingDownloadManagerDelegate> delaying_delegate(
467 new DelayingDownloadManagerDelegate(browser()->profile())); 467 new DelayingDownloadManagerDelegate(browser()->profile()));
468 delaying_delegate->GetDownloadIdReceiverCallback().Run( 468 delaying_delegate->GetDownloadIdReceiverCallback().Run(
469 content::DownloadItem::kInvalidId + 1); 469 content::DownloadItem::kInvalidId + 1);
470 DownloadServiceFactory::GetForBrowserContext(browser()->profile())-> 470 DownloadServiceFactory::GetForBrowserContext(browser()->profile())
471 SetDownloadManagerDelegateForTesting( 471 ->SetDownloadManagerDelegateForTesting(delaying_delegate.Pass());
472 delaying_delegate.PassAs<ChromeDownloadManagerDelegate>());
473 DownloadManager* manager(GetDownloadManager()); 472 DownloadManager* manager(GetDownloadManager());
474 std::vector<DownloadItem*> downloads; 473 std::vector<DownloadItem*> downloads;
475 manager->GetAllDownloads(&downloads); 474 manager->GetAllDownloads(&downloads);
476 ASSERT_EQ(0u, downloads.size()); 475 ASSERT_EQ(0u, downloads.size());
477 476
478 base::FilePath full_file_name, dir; 477 base::FilePath full_file_name, dir;
479 GetDestinationPaths("a", &full_file_name, &dir); 478 GetDestinationPaths("a", &full_file_name, &dir);
480 DownloadItemCreatedObserver creation_observer(manager); 479 DownloadItemCreatedObserver creation_observer(manager);
481 ASSERT_TRUE(GetCurrentTab(browser())->SavePage(full_file_name, dir, 480 ASSERT_TRUE(GetCurrentTab(browser())->SavePage(full_file_name, dir,
482 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); 481 content::SAVE_PAGE_TYPE_AS_ONLY_HTML));
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( 802 base::FilePath download_dir = DownloadPrefs::FromDownloadManager(
804 GetDownloadManager())->DownloadPath(); 803 GetDownloadManager())->DownloadPath();
805 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); 804 base::FilePath filename = download_dir.AppendASCII("dataurl.txt");
806 ASSERT_TRUE(base::PathExists(filename)); 805 ASSERT_TRUE(base::PathExists(filename));
807 std::string contents; 806 std::string contents;
808 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); 807 EXPECT_TRUE(base::ReadFileToString(filename, &contents));
809 EXPECT_EQ("foo", contents); 808 EXPECT_EQ("foo", contents);
810 } 809 }
811 810
812 } // namespace 811 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_ui_controller_unittest.cc ('k') | chrome/browser/history/android/android_provider_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698