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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 void TearDown() override { | 43 void TearDown() override { |
44 Platform::Current() | 44 Platform::Current() |
45 ->GetURLLoaderMockFactory() | 45 ->GetURLLoaderMockFactory() |
46 ->UnregisterAllURLsAndClearMemoryCache(); | 46 ->UnregisterAllURLsAndClearMemoryCache(); |
47 } | 47 } |
48 | 48 |
49 void SetDocumentURL(const KURL& url) { | 49 void SetDocumentURL(const KURL& url) { |
50 FrameLoadRequest request( | 50 FrameLoadRequest request( |
51 nullptr, url, | 51 nullptr, ResourceRequest(url), |
52 SubstituteData(SharedBuffer::Create(), "text/html", "UTF-8", KURL())); | 52 SubstituteData(SharedBuffer::Create(), "text/html", "UTF-8", KURL())); |
53 page_holder_->GetFrame().Loader().Load(request); | 53 page_holder_->GetFrame().Loader().Load(request); |
54 blink::testing::RunPendingTasks(); | 54 blink::testing::RunPendingTasks(); |
55 ASSERT_EQ(url.GetString(), page_holder_->GetDocument().Url().GetString()); | 55 ASSERT_EQ(url.GetString(), page_holder_->GetDocument().Url().GetString()); |
56 } | 56 } |
57 | 57 |
58 const ResourceRequest& PingAndGetRequest(const KURL& ping_url) { | 58 const ResourceRequest& PingAndGetRequest(const KURL& ping_url) { |
59 KURL destination_url(kParsedURLString, "http://navigation.destination"); | 59 KURL destination_url(kParsedURLString, "http://navigation.destination"); |
60 URLTestHelpers::RegisterMockedURLLoad( | 60 URLTestHelpers::RegisterMockedURLLoad( |
61 ping_url, testing::WebTestDataPath("bar.html"), "text/html"); | 61 ping_url, testing::WebTestDataPath("bar.html"), "text/html"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 TEST_F(PingLoaderTest, NonHTTPPingTarget) { | 100 TEST_F(PingLoaderTest, NonHTTPPingTarget) { |
101 SetDocumentURL(KURL(kParsedURLString, "http://127.0.0.1:8000/foo.html")); | 101 SetDocumentURL(KURL(kParsedURLString, "http://127.0.0.1:8000/foo.html")); |
102 const ResourceRequest& ping_request = | 102 const ResourceRequest& ping_request = |
103 PingAndGetRequest(KURL(kParsedURLString, "ftp://localhost/bar.html")); | 103 PingAndGetRequest(KURL(kParsedURLString, "ftp://localhost/bar.html")); |
104 ASSERT_TRUE(ping_request.IsNull()); | 104 ASSERT_TRUE(ping_request.IsNull()); |
105 } | 105 } |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |