Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 1373573002: ABANDONED: OOPIFs: Moving stitching of local paths from renderer to browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-recursive-begone
Patch Set: Removed no longer needed WebKit dependency. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/DEPS » ('j') | content/browser/download/save_package.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 EXPECT_TRUE(base::PathExists(full_file_name)); 797 EXPECT_TRUE(base::PathExists(full_file_name));
798 } 798 }
799 799
800 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest { 800 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest {
801 public: 801 public:
802 SavePageSitePerProcessBrowserTest() {} 802 SavePageSitePerProcessBrowserTest() {}
803 803
804 protected: 804 protected:
805 void SetUpCommandLine(base::CommandLine* command_line) override { 805 void SetUpCommandLine(base::CommandLine* command_line) override {
806 SavePageBrowserTest::SetUpCommandLine(command_line); 806 SavePageBrowserTest::SetUpCommandLine(command_line);
807 807 content::IsolateAllSitesForTesting(command_line);
808 // TODO(lukasza): Enable --site-per-process once crbug.com/526786 is fixed.
809 // (currently, when the line below is uncommented out, the test crashes
810 // under blink::WebLocalFrameImpl::fromFrameOwnerElement called from
811 // blink::WebPageSerializerImpl::openTagToString).
812 //
813 // content::IsolateAllSitesForTesting(command_line);
814 } 808 }
815 809
816 void SetUpOnMainThread() override { 810 void SetUpOnMainThread() override {
817 SavePageBrowserTest::SetUpOnMainThread(); 811 SavePageBrowserTest::SetUpOnMainThread();
818 812
819 host_resolver()->AddRule("*", "127.0.0.1"); 813 host_resolver()->AddRule("*", "127.0.0.1");
820 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 814 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
821 content::SetupCrossSiteRedirector(embedded_test_server()); 815 content::SetupCrossSiteRedirector(embedded_test_server());
822 } 816 }
823 817
824 private: 818 private:
825 DISALLOW_COPY_AND_ASSIGN(SavePageSitePerProcessBrowserTest); 819 DISALLOW_COPY_AND_ASSIGN(SavePageSitePerProcessBrowserTest);
826 }; 820 };
827 821
828 // Test for crbug.com/526786. Without OOPIFs fixes, the test will trigger 822 // Test for crbug.com/526786. Without OOPIFs fixes, the test will trigger
829 // a crash in the renderer process. 823 // a crash in the renderer process.
830 IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveCrossSitePage) { 824 IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveCrossSitePage) {
831 // TODO(lukasza): Remove this check once crbug.com/526786 is fixed.
832 if (content::AreAllSitesIsolatedForTesting()) {
833 LOG(WARNING) << "Skipping the test.";
834 return; // Avoid failing on Site Isolation FYI bot.
835 }
836
837 GURL url(embedded_test_server()->GetURL("a.com", "/save_page/iframes.htm")); 825 GURL url(embedded_test_server()->GetURL("a.com", "/save_page/iframes.htm"));
838 ui_test_utils::NavigateToURL(browser(), url); 826 ui_test_utils::NavigateToURL(browser(), url);
839 827
840 base::FilePath full_file_name, dir; 828 base::FilePath full_file_name, dir;
841 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "iframes", 5, 829 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "iframes", 5,
842 &dir, &full_file_name); 830 &dir, &full_file_name);
843 ASSERT_FALSE(HasFailure()); 831 ASSERT_FALSE(HasFailure());
844 832
845 EXPECT_TRUE(base::DirectoryExists(dir)); 833 EXPECT_TRUE(base::DirectoryExists(dir));
846 base::FilePath expected_files[] = { 834 base::FilePath expected_files[] = {
(...skipping 11 matching lines...) Expand all
858 EXPECT_NE(0, actual_file_size) << "Is " << file_path.value() 846 EXPECT_NE(0, actual_file_size) << "Is " << file_path.value()
859 << " non-empty?"; 847 << " non-empty?";
860 } 848 }
861 849
862 // Verify that local links got correctly replaced with local paths 850 // Verify that local links got correctly replaced with local paths
863 // (most importantly for iframe elements, which are only exercised 851 // (most importantly for iframe elements, which are only exercised
864 // by this particular test). 852 // by this particular test).
865 std::string main_contents; 853 std::string main_contents;
866 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents)); 854 ASSERT_TRUE(base::ReadFileToString(full_file_name, &main_contents));
867 EXPECT_THAT(main_contents, 855 EXPECT_THAT(main_contents,
868 HasSubstr("<iframe src=\"./iframes_files/a.html\"></iframe>")); 856 HasSubstr("<iframe src=\"iframes_files/a.html\"></iframe>"));
869 EXPECT_THAT(main_contents, 857 EXPECT_THAT(main_contents,
870 HasSubstr("<iframe src=\"./iframes_files/b.html\"></iframe>")); 858 HasSubstr("<iframe src=\"iframes_files/b.html\"></iframe>"));
871 EXPECT_THAT(main_contents, 859 EXPECT_THAT(main_contents, HasSubstr("<img src=\"iframes_files/1.png\">"));
872 HasSubstr("<img src=\"./iframes_files/1.png\">"));
873 } 860 }
874 861
875 } // namespace 862 } // namespace
OLDNEW
« no previous file with comments | « no previous file | content/browser/DEPS » ('j') | content/browser/download/save_package.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698