| 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 23 matching lines...) Expand all Loading... |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class PingLoaderTest : public ::testing::Test { | 36 class PingLoaderTest : public ::testing::Test { |
| 37 public: | 37 public: |
| 38 void SetUp() override { | 38 void SetUp() override { |
| 39 m_client = new PingFrameLoaderClient; | 39 m_client = new PingFrameLoaderClient; |
| 40 m_pageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, m_client); | 40 m_pageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, m_client); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TearDown() override { | 43 void TearDown() override { |
| 44 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 44 Platform::current() |
| 45 ->getURLLoaderMockFactory() |
| 46 ->unregisterAllURLsAndClearMemoryCache(); |
| 45 } | 47 } |
| 46 | 48 |
| 47 void setDocumentURL(const KURL& url) { | 49 void setDocumentURL(const KURL& url) { |
| 48 FrameLoadRequest request( | 50 FrameLoadRequest request( |
| 49 nullptr, url, | 51 nullptr, url, |
| 50 SubstituteData(SharedBuffer::create(), "text/html", "UTF-8", KURL())); | 52 SubstituteData(SharedBuffer::create(), "text/html", "UTF-8", KURL())); |
| 51 m_pageHolder->frame().loader().load(request); | 53 m_pageHolder->frame().loader().load(request); |
| 52 blink::testing::runPendingTasks(); | 54 blink::testing::runPendingTasks(); |
| 53 ASSERT_EQ(url.getString(), m_pageHolder->document().url().getString()); | 55 ASSERT_EQ(url.getString(), m_pageHolder->document().url().getString()); |
| 54 } | 56 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 TEST_F(PingLoaderTest, NonHTTPPingTarget) { | 99 TEST_F(PingLoaderTest, NonHTTPPingTarget) { |
| 98 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html")); | 100 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html")); |
| 99 const ResourceRequest& pingRequest = | 101 const ResourceRequest& pingRequest = |
| 100 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html")); | 102 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html")); |
| 101 ASSERT_TRUE(pingRequest.isNull()); | 103 ASSERT_TRUE(pingRequest.isNull()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 } // namespace | 106 } // namespace |
| 105 | 107 |
| 106 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |