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/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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 ASSERT_TRUE(GetCurrentTab(browser())->SavePage( | 554 ASSERT_TRUE(GetCurrentTab(browser())->SavePage( |
555 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); | 555 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); |
556 loop_runner->Run(); | 556 loop_runner->Run(); |
557 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); | 557 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); |
558 persisted.WaitForPersisted(); | 558 persisted.WaitForPersisted(); |
559 | 559 |
560 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 560 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
561 | 561 |
562 EXPECT_TRUE(base::PathExists(full_file_name)); | 562 EXPECT_TRUE(base::PathExists(full_file_name)); |
563 EXPECT_TRUE(base::PathExists(dir)); | 563 EXPECT_TRUE(base::PathExists(dir)); |
564 #if 0 | |
565 // Disabled until the following Blink CL is relanded and rolled: | |
566 // https://codereview.chromium.org/649413002 | |
567 EXPECT_TRUE(base::TextContentsEqual( | 564 EXPECT_TRUE(base::TextContentsEqual( |
568 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), | 565 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), |
569 full_file_name)); | 566 full_file_name)); |
570 #endif | |
571 EXPECT_TRUE(base::ContentsEqual( | 567 EXPECT_TRUE(base::ContentsEqual( |
572 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), | 568 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), |
573 dir.AppendASCII("1.png"))); | 569 dir.AppendASCII("1.png"))); |
574 EXPECT_TRUE(base::ContentsEqual( | 570 EXPECT_TRUE(base::ContentsEqual( |
575 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), | 571 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), |
576 dir.AppendASCII("1.css"))); | 572 dir.AppendASCII("1.css"))); |
577 } | 573 } |
578 | 574 |
579 // Invoke a save page during the initial navigation. | 575 // Invoke a save page during the initial navigation. |
580 // (Regression test for http://crbug.com/156538). | 576 // (Regression test for http://crbug.com/156538). |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); | 650 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); |
655 | 651 |
656 loop_runner->Run(); | 652 loop_runner->Run(); |
657 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); | 653 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); |
658 persisted.WaitForPersisted(); | 654 persisted.WaitForPersisted(); |
659 | 655 |
660 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 656 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
661 | 657 |
662 EXPECT_TRUE(base::PathExists(full_file_name)); | 658 EXPECT_TRUE(base::PathExists(full_file_name)); |
663 EXPECT_TRUE(base::PathExists(dir)); | 659 EXPECT_TRUE(base::PathExists(dir)); |
664 #if 0 | |
665 // Disabled until the following Blink CL is relanded and rolled: | |
666 // https://codereview.chromium.org/649413002 | |
667 EXPECT_TRUE(base::TextContentsEqual( | 660 EXPECT_TRUE(base::TextContentsEqual( |
668 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), | 661 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), |
669 full_file_name)); | 662 full_file_name)); |
670 #endif | |
671 EXPECT_TRUE(base::ContentsEqual( | 663 EXPECT_TRUE(base::ContentsEqual( |
672 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), | 664 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), |
673 dir.AppendASCII("1.png"))); | 665 dir.AppendASCII("1.png"))); |
674 EXPECT_TRUE(base::ContentsEqual( | 666 EXPECT_TRUE(base::ContentsEqual( |
675 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), | 667 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), |
676 dir.AppendASCII("1.css"))); | 668 dir.AppendASCII("1.css"))); |
677 } | 669 } |
678 | 670 |
679 // Disabled on Windows due to flakiness. http://crbug.com/162323 | 671 // Disabled on Windows due to flakiness. http://crbug.com/162323 |
680 #if defined(OS_WIN) | 672 #if defined(OS_WIN) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( | 802 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( |
811 GetDownloadManager())->DownloadPath(); | 803 GetDownloadManager())->DownloadPath(); |
812 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); | 804 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); |
813 ASSERT_TRUE(base::PathExists(filename)); | 805 ASSERT_TRUE(base::PathExists(filename)); |
814 std::string contents; | 806 std::string contents; |
815 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); | 807 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); |
816 EXPECT_EQ("foo", contents); | 808 EXPECT_EQ("foo", contents); |
817 } | 809 } |
818 | 810 |
819 } // namespace | 811 } // namespace |
OLD | NEW |