OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/loader/PingLoader.h" | 5 #include "core/loader/PingLoader.h" |
6 | 6 |
7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "core/loader/EmptyClients.h" | 8 #include "core/loader/EmptyClients.h" |
9 #include "core/loader/FrameLoader.h" | 9 #include "core/loader/FrameLoader.h" |
10 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 FrameLoadRequest request( | 48 FrameLoadRequest request( |
49 nullptr, url, | 49 nullptr, url, |
50 SubstituteData(SharedBuffer::create(), "text/html", "UTF-8", KURL())); | 50 SubstituteData(SharedBuffer::create(), "text/html", "UTF-8", KURL())); |
51 m_pageHolder->frame().loader().load(request); | 51 m_pageHolder->frame().loader().load(request); |
52 blink::testing::runPendingTasks(); | 52 blink::testing::runPendingTasks(); |
53 ASSERT_EQ(url.getString(), m_pageHolder->document().url().getString()); | 53 ASSERT_EQ(url.getString(), m_pageHolder->document().url().getString()); |
54 } | 54 } |
55 | 55 |
56 const ResourceRequest& pingAndGetRequest(const KURL& pingURL) { | 56 const ResourceRequest& pingAndGetRequest(const KURL& pingURL) { |
57 KURL destinationURL(ParsedURLString, "http://navigation.destination"); | 57 KURL destinationURL(ParsedURLString, "http://navigation.destination"); |
58 URLTestHelpers::registerMockedURLLoad(pingURL, "bar.html", "text/html"); | 58 URLTestHelpers::registerMockedURLLoad( |
| 59 pingURL, testing::webTestDataPath("bar.html"), "text/html"); |
59 PingLoader::sendLinkAuditPing(&m_pageHolder->frame(), pingURL, | 60 PingLoader::sendLinkAuditPing(&m_pageHolder->frame(), pingURL, |
60 destinationURL); | 61 destinationURL); |
61 const ResourceRequest& pingRequest = m_client->pingRequest(); | 62 const ResourceRequest& pingRequest = m_client->pingRequest(); |
62 if (!pingRequest.isNull()) { | 63 if (!pingRequest.isNull()) { |
63 EXPECT_EQ(destinationURL.getString(), | 64 EXPECT_EQ(destinationURL.getString(), |
64 pingRequest.httpHeaderField("Ping-To")); | 65 pingRequest.httpHeaderField("Ping-To")); |
65 } | 66 } |
66 return pingRequest; | 67 return pingRequest; |
67 } | 68 } |
68 | 69 |
(...skipping 24 matching lines...) Expand all Loading... |
93 TEST_F(PingLoaderTest, NonHTTPPingTarget) { | 94 TEST_F(PingLoaderTest, NonHTTPPingTarget) { |
94 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html")); | 95 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html")); |
95 const ResourceRequest& pingRequest = | 96 const ResourceRequest& pingRequest = |
96 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html")); | 97 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html")); |
97 ASSERT_TRUE(pingRequest.isNull()); | 98 ASSERT_TRUE(pingRequest.isNull()); |
98 } | 99 } |
99 | 100 |
100 } // namespace | 101 } // namespace |
101 | 102 |
102 } // namespace blink | 103 } // namespace blink |
OLD | NEW |