| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 const std::string& original_file_path, | 140 const std::string& original_file_path, |
| 141 const net::HostPortPair& host_port_pair, | 141 const net::HostPortPair& host_port_pair, |
| 142 std::string* replacement_path) { | 142 std::string* replacement_path) { |
| 143 base::StringPairs replacement_text; | 143 base::StringPairs replacement_text; |
| 144 replacement_text.push_back( | 144 replacement_text.push_back( |
| 145 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); | 145 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); |
| 146 net::test_server::GetFilePathWithReplacements( | 146 net::test_server::GetFilePathWithReplacements( |
| 147 original_file_path, replacement_text, replacement_path); | 147 original_file_path, replacement_text, replacement_path); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void StartServer() { | 150 void SetUpOnMainThread() override { |
| 151 // Support multiple sites on the test server. | 151 // Support multiple sites on the test server. |
| 152 host_resolver()->AddRule("*", "127.0.0.1"); | 152 host_resolver()->AddRule("*", "127.0.0.1"); |
| 153 } |
| 154 |
| 155 void StartServer() { |
| 153 ASSERT_TRUE(embedded_test_server()->Start()); | 156 ASSERT_TRUE(embedded_test_server()->Start()); |
| 154 | 157 |
| 155 foo_host_port_ = embedded_test_server()->host_port_pair(); | 158 foo_host_port_ = embedded_test_server()->host_port_pair(); |
| 156 foo_host_port_.set_host(foo_com_); | 159 foo_host_port_.set_host(foo_com_); |
| 157 } | 160 } |
| 158 | 161 |
| 159 void StartEmbeddedServer() { | 162 void StartEmbeddedServer() { |
| 160 // Support multiple sites on the embedded test server. | |
| 161 host_resolver()->AddRule("*", "127.0.0.1"); | 163 host_resolver()->AddRule("*", "127.0.0.1"); |
| 162 SetupCrossSiteRedirector(embedded_test_server()); | 164 SetupCrossSiteRedirector(embedded_test_server()); |
| 163 ASSERT_TRUE(embedded_test_server()->Start()); | 165 ASSERT_TRUE(embedded_test_server()->Start()); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // Returns a URL on foo.com with the given path. | 168 // Returns a URL on foo.com with the given path. |
| 167 GURL GetCrossSiteURL(const std::string& path) { | 169 GURL GetCrossSiteURL(const std::string& path) { |
| 168 GURL cross_site_url(embedded_test_server()->GetURL(path)); | 170 GURL cross_site_url(embedded_test_server()->GetURL(path)); |
| 169 return cross_site_url.ReplaceComponents(replace_host_); | 171 return cross_site_url.ReplaceComponents(replace_host_); |
| 170 } | 172 } |
| (...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 EXPECT_TRUE(ExecuteScript(grandchild, script)); | 3387 EXPECT_TRUE(ExecuteScript(grandchild, script)); |
| 3386 observer.Wait(); | 3388 observer.Wait(); |
| 3387 } | 3389 } |
| 3388 | 3390 |
| 3389 EXPECT_EQ(url, grandchild->current_url()); | 3391 EXPECT_EQ(url, grandchild->current_url()); |
| 3390 ASSERT_EQ(1U, grandchild->child_count()); | 3392 ASSERT_EQ(1U, grandchild->child_count()); |
| 3391 EXPECT_EQ(child_url, grandchild->child_at(0)->current_url()); | 3393 EXPECT_EQ(child_url, grandchild->child_at(0)->current_url()); |
| 3392 } | 3394 } |
| 3393 | 3395 |
| 3394 } // namespace content | 3396 } // namespace content |
| OLD | NEW |