| 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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 EXPECT_TRUE(base::PathExists(full_file_name)); | 796 EXPECT_TRUE(base::PathExists(full_file_name)); |
| 797 } | 797 } |
| 798 | 798 |
| 799 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest { | 799 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest { |
| 800 public: | 800 public: |
| 801 SavePageSitePerProcessBrowserTest() {} | 801 SavePageSitePerProcessBrowserTest() {} |
| 802 | 802 |
| 803 protected: | 803 protected: |
| 804 void SetUpCommandLine(base::CommandLine* command_line) override { | 804 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 805 SavePageBrowserTest::SetUpCommandLine(command_line); | 805 SavePageBrowserTest::SetUpCommandLine(command_line); |
| 806 | 806 content::IsolateAllSitesForTesting(command_line); |
| 807 // TODO(lukasza): Enable --site-per-process once crbug.com/526786 is fixed. | |
| 808 // (currently, when the line below is uncommented out, the test crashes | |
| 809 // under blink::WebLocalFrameImpl::fromFrameOwnerElement called from | |
| 810 // blink::WebPageSerializerImpl::openTagToString). | |
| 811 // | |
| 812 // content::IsolateAllSitesForTesting(command_line); | |
| 813 } | 807 } |
| 814 | 808 |
| 815 void SetUpOnMainThread() override { | 809 void SetUpOnMainThread() override { |
| 816 SavePageBrowserTest::SetUpOnMainThread(); | 810 SavePageBrowserTest::SetUpOnMainThread(); |
| 817 | 811 |
| 818 host_resolver()->AddRule("*", "127.0.0.1"); | 812 host_resolver()->AddRule("*", "127.0.0.1"); |
| 819 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 813 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 820 content::SetupCrossSiteRedirector(embedded_test_server()); | 814 content::SetupCrossSiteRedirector(embedded_test_server()); |
| 821 } | 815 } |
| 822 | 816 |
| 823 private: | 817 private: |
| 824 DISALLOW_COPY_AND_ASSIGN(SavePageSitePerProcessBrowserTest); | 818 DISALLOW_COPY_AND_ASSIGN(SavePageSitePerProcessBrowserTest); |
| 825 }; | 819 }; |
| 826 | 820 |
| 827 // Test for crbug.com/526786. Without OOPIFs fixes, the test will trigger | 821 // Test for crbug.com/526786. Without OOPIFs fixes, the test will trigger |
| 828 // a crash in the renderer process. | 822 // a crash in the renderer process. |
| 829 IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveCrossSitePage) { | 823 IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveCrossSitePage) { |
| 830 // TODO(lukasza): Remove this check once crbug.com/526786 is fixed. | |
| 831 if (content::AreAllSitesIsolatedForTesting()) { | |
| 832 LOG(WARNING) << "Skipping the test."; | |
| 833 return; // Avoid failing on Site Isolation FYI bot. | |
| 834 } | |
| 835 | |
| 836 GURL url(embedded_test_server()->GetURL("a.com", "/save_page/iframes.htm")); | 824 GURL url(embedded_test_server()->GetURL("a.com", "/save_page/iframes.htm")); |
| 837 ui_test_utils::NavigateToURL(browser(), url); | 825 ui_test_utils::NavigateToURL(browser(), url); |
| 838 | 826 |
| 839 base::FilePath full_file_name, dir; | 827 base::FilePath full_file_name, dir; |
| 840 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "iframes", 5, | 828 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "iframes", 5, |
| 841 &dir, &full_file_name); | 829 &dir, &full_file_name); |
| 842 ASSERT_FALSE(HasFailure()); | 830 ASSERT_FALSE(HasFailure()); |
| 843 | 831 |
| 844 EXPECT_TRUE(base::DirectoryExists(dir)); | 832 EXPECT_TRUE(base::DirectoryExists(dir)); |
| 845 base::FilePath expected_files[] = { | 833 base::FilePath expected_files[] = { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 865 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents)); | 853 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents)); |
| 866 EXPECT_THAT(main_contents, | 854 EXPECT_THAT(main_contents, |
| 867 HasSubstr("<iframe src=\"./iframes_files/a.html\"></iframe>")); | 855 HasSubstr("<iframe src=\"./iframes_files/a.html\"></iframe>")); |
| 868 EXPECT_THAT(main_contents, | 856 EXPECT_THAT(main_contents, |
| 869 HasSubstr("<iframe src=\"./iframes_files/b.html\"></iframe>")); | 857 HasSubstr("<iframe src=\"./iframes_files/b.html\"></iframe>")); |
| 870 EXPECT_THAT(main_contents, | 858 EXPECT_THAT(main_contents, |
| 871 HasSubstr("<img src=\"./iframes_files/1.png\">")); | 859 HasSubstr("<img src=\"./iframes_files/1.png\">")); |
| 872 } | 860 } |
| 873 | 861 |
| 874 } // namespace | 862 } // namespace |
| OLD | NEW |