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/callback.h" | 6 #include "base/callback.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 class MHTMLGenerationTest : public ContentBrowserTest { | 27 class MHTMLGenerationTest : public ContentBrowserTest { |
28 public: | 28 public: |
29 MHTMLGenerationTest() : has_mhtml_callback_run_(false), file_size_(0) {} | 29 MHTMLGenerationTest() : has_mhtml_callback_run_(false), file_size_(0) {} |
30 | 30 |
31 protected: | 31 protected: |
32 void SetUp() override { | 32 void SetUp() override { |
33 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 33 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 34 ASSERT_TRUE(embedded_test_server()->Start()); |
35 ContentBrowserTest::SetUp(); | 35 ContentBrowserTest::SetUp(); |
36 } | 36 } |
37 | 37 |
38 void GenerateMHTML(const base::FilePath& path, const GURL& url) { | 38 void GenerateMHTML(const base::FilePath& path, const GURL& url) { |
39 NavigateToURL(shell(), url); | 39 NavigateToURL(shell(), url); |
40 | 40 |
41 base::RunLoop run_loop; | 41 base::RunLoop run_loop; |
42 shell()->web_contents()->GenerateMHTML( | 42 shell()->web_contents()->GenerateMHTML( |
43 path, base::Bind(&MHTMLGenerationTest::MHTMLGenerated, this, | 43 path, base::Bind(&MHTMLGenerationTest::MHTMLGenerated, this, |
44 run_loop.QuitClosure())); | 44 run_loop.QuitClosure())); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 MHTMLGenerationTest::SetUpCommandLine(command_line); | 138 MHTMLGenerationTest::SetUpCommandLine(command_line); |
139 | 139 |
140 // Append --site-per-process flag. | 140 // Append --site-per-process flag. |
141 content::IsolateAllSitesForTesting(command_line); | 141 content::IsolateAllSitesForTesting(command_line); |
142 } | 142 } |
143 | 143 |
144 void SetUpOnMainThread() override { | 144 void SetUpOnMainThread() override { |
145 MHTMLGenerationTest::SetUpOnMainThread(); | 145 MHTMLGenerationTest::SetUpOnMainThread(); |
146 | 146 |
147 host_resolver()->AddRule("*", "127.0.0.1"); | 147 host_resolver()->AddRule("*", "127.0.0.1"); |
148 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 148 ASSERT_TRUE(embedded_test_server()->Start()); |
149 content::SetupCrossSiteRedirector(embedded_test_server()); | 149 content::SetupCrossSiteRedirector(embedded_test_server()); |
150 } | 150 } |
151 | 151 |
152 private: | 152 private: |
153 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationSitePerProcessTest); | 153 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationSitePerProcessTest); |
154 }; | 154 }; |
155 | 155 |
156 // Test for crbug.com/538766. | 156 // Test for crbug.com/538766. |
157 // Disabled because the test will fail until the bug is fixed | 157 // Disabled because the test will fail until the bug is fixed |
158 // (but note that the test only fails with --site-per-process flag). | 158 // (but note that the test only fails with --site-per-process flag). |
(...skipping 16 matching lines...) Expand all Loading... |
175 | 175 |
176 // Make sure that URLs of both frames are present | 176 // Make sure that URLs of both frames are present |
177 // (note that these are single-line regexes). | 177 // (note that these are single-line regexes). |
178 EXPECT_THAT( | 178 EXPECT_THAT( |
179 mhtml, | 179 mhtml, |
180 ContainsRegex("Content-Location:.*/frame_tree/page_with_one_frame.html")); | 180 ContainsRegex("Content-Location:.*/frame_tree/page_with_one_frame.html")); |
181 EXPECT_THAT(mhtml, ContainsRegex("Content-Location:.*/title1.html")); | 181 EXPECT_THAT(mhtml, ContainsRegex("Content-Location:.*/title1.html")); |
182 } | 182 } |
183 | 183 |
184 } // namespace content | 184 } // namespace content |
OLD | NEW |