| 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/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/net/chrome_net_log.h" | 10 #include "chrome/browser/net/chrome_net_log.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 net::HostPortPair host_port_pair = net::HostPortPair::FromURL(preconnect_url); | 302 net::HostPortPair host_port_pair = net::HostPortPair::FromURL(preconnect_url); |
| 303 ConnectNetLogObserver net_log_observer(host_port_pair.ToString()); | 303 ConnectNetLogObserver net_log_observer(host_port_pair.ToString()); |
| 304 net_log_observer.Attach(); | 304 net_log_observer.Attach(); |
| 305 | 305 |
| 306 ui_test_utils::NavigateToURL(browser(), GURL(data_uri)); | 306 ui_test_utils::NavigateToURL(browser(), GURL(data_uri)); |
| 307 | 307 |
| 308 net_log_observer.WaitForConnect(); | 308 net_log_observer.WaitForConnect(); |
| 309 net_log_observer.Detach(); | 309 net_log_observer.Detach(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, PreconnectAnonymous) { |
| 313 ASSERT_TRUE(test_server()->Start()); |
| 314 |
| 315 // Create a HTML preconnect reference to the local server in the form |
| 316 // <link rel="preconnect" href="http://test-server/"> |
| 317 // and navigate to it as a data URI. |
| 318 GURL preconnect_url = test_server()->GetURL(""); |
| 319 std::string preconnect_content = |
| 320 "<link rel=\"preconnect\" crossorigin href=\"" |
| 321 + preconnect_url.spec() + "\">"; |
| 322 std::string encoded; |
| 323 base::Base64Encode(preconnect_content, &encoded); |
| 324 std::string data_uri = "data:text/html;base64," + encoded; |
| 325 |
| 326 net::HostPortPair host_port_pair = net::HostPortPair::FromURL(preconnect_url); |
| 327 ConnectNetLogObserver net_log_observer("pm/" + host_port_pair.ToString()); |
| 328 net_log_observer.Attach(); |
| 329 |
| 330 ui_test_utils::NavigateToURL(browser(), GURL(data_uri)); |
| 331 |
| 332 net_log_observer.WaitForConnect(); |
| 333 net_log_observer.Detach(); |
| 334 } |
| 335 |
| 312 } // namespace chrome_browser_net | 336 } // namespace chrome_browser_net |
| 313 | 337 |
| OLD | NEW |