OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | |
8 #include <string> | 7 #include <string> |
| 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
16 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 DISALLOW_COPY_AND_ASSIGN(DelayingDownloadManagerDelegate); | 489 DISALLOW_COPY_AND_ASSIGN(DelayingDownloadManagerDelegate); |
490 }; | 490 }; |
491 | 491 |
492 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { | 492 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { |
493 GURL url = NavigateToMockURL("a"); | 493 GURL url = NavigateToMockURL("a"); |
494 scoped_ptr<DelayingDownloadManagerDelegate> delaying_delegate( | 494 scoped_ptr<DelayingDownloadManagerDelegate> delaying_delegate( |
495 new DelayingDownloadManagerDelegate(browser()->profile())); | 495 new DelayingDownloadManagerDelegate(browser()->profile())); |
496 delaying_delegate->GetDownloadIdReceiverCallback().Run( | 496 delaying_delegate->GetDownloadIdReceiverCallback().Run( |
497 content::DownloadItem::kInvalidId + 1); | 497 content::DownloadItem::kInvalidId + 1); |
498 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) | 498 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) |
499 ->SetDownloadManagerDelegateForTesting(delaying_delegate.Pass()); | 499 ->SetDownloadManagerDelegateForTesting(std::move(delaying_delegate)); |
500 DownloadManager* manager(GetDownloadManager()); | 500 DownloadManager* manager(GetDownloadManager()); |
501 std::vector<DownloadItem*> downloads; | 501 std::vector<DownloadItem*> downloads; |
502 manager->GetAllDownloads(&downloads); | 502 manager->GetAllDownloads(&downloads); |
503 ASSERT_EQ(0u, downloads.size()); | 503 ASSERT_EQ(0u, downloads.size()); |
504 | 504 |
505 base::FilePath full_file_name, dir; | 505 base::FilePath full_file_name, dir; |
506 GetDestinationPaths("a", &full_file_name, &dir); | 506 GetDestinationPaths("a", &full_file_name, &dir); |
507 DownloadItemCreatedObserver creation_observer(manager); | 507 DownloadItemCreatedObserver creation_observer(manager); |
508 ASSERT_TRUE(GetCurrentTab(browser())->SavePage(full_file_name, dir, | 508 ASSERT_TRUE(GetCurrentTab(browser())->SavePage(full_file_name, dir, |
509 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); | 509 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 TestMultiFramePage(save_page_type, url, 6, expected_substrings); | 1192 TestMultiFramePage(save_page_type, url, 6, expected_substrings); |
1193 } | 1193 } |
1194 | 1194 |
1195 INSTANTIATE_TEST_CASE_P( | 1195 INSTANTIATE_TEST_CASE_P( |
1196 SaveType, | 1196 SaveType, |
1197 SavePageMultiFrameBrowserTest, | 1197 SavePageMultiFrameBrowserTest, |
1198 ::testing::Values(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, | 1198 ::testing::Values(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, |
1199 content::SAVE_PAGE_TYPE_AS_MHTML)); | 1199 content::SAVE_PAGE_TYPE_AS_MHTML)); |
1200 | 1200 |
1201 } // namespace | 1201 } // namespace |
OLD | NEW |