| 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 "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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, | 307 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, |
| 308 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); | 308 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); |
| 309 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); | 309 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); |
| 310 item->Cancel(true); | 310 item->Cancel(true); |
| 311 | 311 |
| 312 // TODO(rdsmith): Fix DII::Cancel() to actually cancel the save package. | 312 // TODO(rdsmith): Fix DII::Cancel() to actually cancel the save package. |
| 313 // Currently it's ignored. | 313 // Currently it's ignored. |
| 314 EXPECT_EQ(url, WaitForSavePackageToFinish()); | 314 EXPECT_EQ(url, WaitForSavePackageToFinish()); |
| 315 | 315 |
| 316 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 316 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
| 317 CheckDownloadHistory(url, full_file_name, 1); // a.htm is 1 file. | |
| 318 | 317 |
| 319 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 318 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
| 320 EXPECT_FALSE(file_util::PathExists(dir)); | 319 EXPECT_FALSE(file_util::PathExists(dir)); |
| 321 EXPECT_TRUE(file_util::ContentsEqual( | 320 EXPECT_TRUE(file_util::ContentsEqual( |
| 322 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), | 321 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), |
| 323 full_file_name)); | 322 full_file_name)); |
| 324 } | 323 } |
| 325 | 324 |
| 326 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { | 325 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { |
| 327 GURL url = NavigateToMockURL("a"); | 326 GURL url = NavigateToMockURL("a"); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 content::NotificationService::AllSources()); | 520 content::NotificationService::AllSources()); |
| 522 chrome::SavePage(browser()); | 521 chrome::SavePage(browser()); |
| 523 observer.Wait(); | 522 observer.Wait(); |
| 524 CheckDownloadHistory(url, full_file_name, -1); | 523 CheckDownloadHistory(url, full_file_name, -1); |
| 525 | 524 |
| 526 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 525 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
| 527 int64 actual_file_size = -1; | 526 int64 actual_file_size = -1; |
| 528 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 527 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
| 529 EXPECT_LE(kFileSizeMin, actual_file_size); | 528 EXPECT_LE(kFileSizeMin, actual_file_size); |
| 530 } | 529 } |
| OLD | NEW |