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