Chromium Code Reviews| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, DISABLED_SaveCompleteHTML) { | 540 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, DISABLED_SaveCompleteHTML) { |
| 541 GURL url = NavigateToMockURL("b"); | 541 GURL url = NavigateToMockURL("b"); |
| 542 | 542 |
| 543 base::FilePath full_file_name, dir; | 543 base::FilePath full_file_name, dir; |
| 544 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "b", 3, &dir, | 544 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "b", 3, &dir, |
| 545 &full_file_name); | 545 &full_file_name); |
| 546 ASSERT_FALSE(HasFailure()); | 546 ASSERT_FALSE(HasFailure()); |
| 547 | 547 |
| 548 EXPECT_TRUE(base::PathExists(full_file_name)); | 548 EXPECT_TRUE(base::PathExists(full_file_name)); |
| 549 EXPECT_TRUE(base::PathExists(dir)); | 549 EXPECT_TRUE(base::PathExists(dir)); |
| 550 EXPECT_TRUE(base::TextContentsEqual( | 550 EXPECT_TRUE(base::ContentsEqual( |
| 551 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), | 551 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), |
| 552 full_file_name)); | 552 full_file_name)); |
| 553 EXPECT_TRUE(base::ContentsEqual( | 553 EXPECT_TRUE(base::ContentsEqual( |
| 554 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), | 554 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), |
| 555 dir.AppendASCII("1.png"))); | 555 dir.AppendASCII("1.png"))); |
| 556 EXPECT_TRUE(base::ContentsEqual( | 556 EXPECT_TRUE(base::ContentsEqual( |
| 557 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), | 557 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), |
| 558 dir.AppendASCII("1.css"))); | 558 dir.AppendASCII("1.css"))); |
| 559 } | 559 } |
| 560 | 560 |
| 561 // Disabled on Windows due to flakiness. http://crbug.com/162323 | |
|
Randy Smith (Not in Mondays)
2015/10/15 18:57:06
This is a new test; have you confirmed that it's f
Łukasz Anforowicz
2015/10/20 21:08:43
Done.
Also following up with the following CLs:
-
| |
| 562 #if defined(OS_WIN) | |
| 563 #define MAYBE_SaveUTF32CompleteHTML DISABLED_SaveUTF32CompleteHTML | |
| 564 #else | |
| 565 #define MAYBE_SaveUTF32CompleteHTML SaveUTF32CompleteHTML | |
| 566 #endif | |
| 567 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveUTF32CompleteHTML) { | |
| 568 GURL url = NavigateToMockURL("utf32"); | |
| 569 ui_test_utils::NavigateToURL(browser(), url); | |
| 570 | |
| 571 base::FilePath full_file_name, dir; | |
| 572 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "utf32", 3, | |
| 573 &dir, &full_file_name); | |
| 574 ASSERT_FALSE(HasFailure()); | |
| 575 | |
| 576 EXPECT_TRUE(base::PathExists(full_file_name)); | |
| 577 EXPECT_TRUE(base::PathExists(dir)); | |
| 578 EXPECT_TRUE(base::ContentsEqual( | |
|
Randy Smith (Not in Mondays)
2015/10/15 18:57:06
I wince a bit at this, since it tests the implemen
Łukasz Anforowicz
2015/10/20 21:08:43
I still think that comparing the whole file conten
| |
| 579 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("utf32.saved.htm"), | |
| 580 full_file_name)); | |
| 581 EXPECT_TRUE(base::ContentsEqual( | |
| 582 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), | |
| 583 dir.AppendASCII("1.png"))); | |
| 584 EXPECT_TRUE(base::ContentsEqual( | |
| 585 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), | |
| 586 dir.AppendASCII("1.css"))); | |
| 587 } | |
| 588 | |
| 561 // Invoke a save page during the initial navigation. | 589 // Invoke a save page during the initial navigation. |
| 562 // (Regression test for http://crbug.com/156538). | 590 // (Regression test for http://crbug.com/156538). |
| 563 // Disabled on Windows due to flakiness. http://crbug.com/162323 | 591 // Disabled on Windows due to flakiness. http://crbug.com/162323 |
| 564 #if defined(OS_WIN) | 592 #if defined(OS_WIN) |
| 565 #define MAYBE_SaveDuringInitialNavigationIncognito DISABLED_SaveDuringInitialNav igationIncognito | 593 #define MAYBE_SaveDuringInitialNavigationIncognito DISABLED_SaveDuringInitialNav igationIncognito |
| 566 #else | 594 #else |
| 567 #define MAYBE_SaveDuringInitialNavigationIncognito SaveDuringInitialNavigationIn cognito | 595 #define MAYBE_SaveDuringInitialNavigationIncognito SaveDuringInitialNavigationIn cognito |
| 568 #endif | 596 #endif |
| 569 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, | 597 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, |
| 570 MAYBE_SaveDuringInitialNavigationIncognito) { | 598 MAYBE_SaveDuringInitialNavigationIncognito) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 loop_runner->QuitClosure()); | 659 loop_runner->QuitClosure()); |
| 632 ASSERT_TRUE(GetCurrentTab(browser())->SavePage( | 660 ASSERT_TRUE(GetCurrentTab(browser())->SavePage( |
| 633 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); | 661 full_file_name, dir, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML)); |
| 634 | 662 |
| 635 loop_runner->Run(); | 663 loop_runner->Run(); |
| 636 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); | 664 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); |
| 637 persisted.WaitForPersisted(); | 665 persisted.WaitForPersisted(); |
| 638 | 666 |
| 639 EXPECT_TRUE(base::PathExists(full_file_name)); | 667 EXPECT_TRUE(base::PathExists(full_file_name)); |
| 640 EXPECT_TRUE(base::PathExists(dir)); | 668 EXPECT_TRUE(base::PathExists(dir)); |
| 641 EXPECT_TRUE(base::TextContentsEqual( | 669 EXPECT_TRUE(base::ContentsEqual( |
| 642 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), | 670 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), |
| 643 full_file_name)); | 671 full_file_name)); |
| 644 EXPECT_TRUE(base::ContentsEqual( | 672 EXPECT_TRUE(base::ContentsEqual( |
| 645 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), | 673 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), |
| 646 dir.AppendASCII("1.png"))); | 674 dir.AppendASCII("1.png"))); |
| 647 EXPECT_TRUE(base::ContentsEqual( | 675 EXPECT_TRUE(base::ContentsEqual( |
| 648 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), | 676 test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), |
| 649 dir.AppendASCII("1.css"))); | 677 dir.AppendASCII("1.css"))); |
| 650 } | 678 } |
| 651 | 679 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents)); | 894 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents)); |
| 867 EXPECT_THAT(main_contents, | 895 EXPECT_THAT(main_contents, |
| 868 HasSubstr("<iframe src=\"./iframes_files/a.html\"></iframe>")); | 896 HasSubstr("<iframe src=\"./iframes_files/a.html\"></iframe>")); |
| 869 EXPECT_THAT(main_contents, | 897 EXPECT_THAT(main_contents, |
| 870 HasSubstr("<iframe src=\"./iframes_files/b.html\"></iframe>")); | 898 HasSubstr("<iframe src=\"./iframes_files/b.html\"></iframe>")); |
| 871 EXPECT_THAT(main_contents, | 899 EXPECT_THAT(main_contents, |
| 872 HasSubstr("<img src=\"./iframes_files/1.png\">")); | 900 HasSubstr("<img src=\"./iframes_files/1.png\">")); |
| 873 } | 901 } |
| 874 | 902 |
| 875 } // namespace | 903 } // namespace |
| OLD | NEW |