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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, | 304 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, |
305 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); | 305 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); |
306 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); | 306 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); |
307 item->Cancel(true); | 307 item->Cancel(true); |
308 | 308 |
309 // TODO(rdsmith): Fix DII::Cancel() to actually cancel the save package. | 309 // TODO(rdsmith): Fix DII::Cancel() to actually cancel the save package. |
310 // Currently it's ignored. | 310 // Currently it's ignored. |
311 EXPECT_EQ(url, WaitForSavePackageToFinish()); | 311 EXPECT_EQ(url, WaitForSavePackageToFinish()); |
312 | 312 |
313 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 313 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
314 CheckDownloadHistory(url, full_file_name, 1); // a.htm is 1 file. | |
benjhayden
2012/08/22 19:07:31
What happened to this?
Randy Smith (Not in Mondays)
2012/08/23 16:55:58
Restored after adding a "wait for persisted".
| |
315 | 314 |
316 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 315 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
317 EXPECT_FALSE(file_util::PathExists(dir)); | 316 EXPECT_FALSE(file_util::PathExists(dir)); |
318 EXPECT_TRUE(file_util::ContentsEqual( | 317 EXPECT_TRUE(file_util::ContentsEqual( |
319 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), | 318 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), |
320 full_file_name)); | 319 full_file_name)); |
321 } | 320 } |
322 | 321 |
323 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { | 322 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { |
324 GURL url = NavigateToMockURL("a"); | 323 GURL url = NavigateToMockURL("a"); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 content::NotificationService::AllSources()); | 517 content::NotificationService::AllSources()); |
519 chrome::SavePage(browser()); | 518 chrome::SavePage(browser()); |
520 observer.Wait(); | 519 observer.Wait(); |
521 CheckDownloadHistory(url, full_file_name, -1); | 520 CheckDownloadHistory(url, full_file_name, -1); |
522 | 521 |
523 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 522 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
524 int64 actual_file_size = -1; | 523 int64 actual_file_size = -1; |
525 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 524 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
526 EXPECT_LE(kFileSizeMin, actual_file_size); | 525 EXPECT_LE(kFileSizeMin, actual_file_size); |
527 } | 526 } |
OLD | NEW |