Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: third_party/WebKit/Source/core/loader/PingLoaderTest.cpp

Issue 2682533002: Fix PingLoaderTest crashing the next test (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 KURL destinationURL(ParsedURLString, "http://navigation.destination"); 57 KURL destinationURL(ParsedURLString, "http://navigation.destination");
58 URLTestHelpers::registerMockedURLLoad( 58 URLTestHelpers::registerMockedURLLoad(
59 pingURL, testing::webTestDataPath("bar.html"), "text/html"); 59 pingURL, testing::webTestDataPath("bar.html"), "text/html");
60 PingLoader::sendLinkAuditPing(&m_pageHolder->frame(), pingURL, 60 PingLoader::sendLinkAuditPing(&m_pageHolder->frame(), pingURL,
61 destinationURL); 61 destinationURL);
62 const ResourceRequest& pingRequest = m_client->pingRequest(); 62 const ResourceRequest& pingRequest = m_client->pingRequest();
63 if (!pingRequest.isNull()) { 63 if (!pingRequest.isNull()) {
64 EXPECT_EQ(destinationURL.getString(), 64 EXPECT_EQ(destinationURL.getString(),
65 pingRequest.httpHeaderField("Ping-To")); 65 pingRequest.httpHeaderField("Ping-To"));
66 } 66 }
67 // Serve the ping request, since it will otherwise bleed in to the next
68 // test, and once begun there is no way to cancel it directly.
69 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
67 return pingRequest; 70 return pingRequest;
68 } 71 }
69 72
70 private: 73 private:
71 Persistent<PingFrameLoaderClient> m_client; 74 Persistent<PingFrameLoaderClient> m_client;
72 std::unique_ptr<DummyPageHolder> m_pageHolder; 75 std::unique_ptr<DummyPageHolder> m_pageHolder;
73 }; 76 };
74 77
75 TEST_F(PingLoaderTest, HTTPSToHTTPS) { 78 TEST_F(PingLoaderTest, HTTPSToHTTPS) {
76 KURL pingURL(ParsedURLString, "https://localhost/bar.html"); 79 KURL pingURL(ParsedURLString, "https://localhost/bar.html");
(...skipping 17 matching lines...) Expand all
94 TEST_F(PingLoaderTest, NonHTTPPingTarget) { 97 TEST_F(PingLoaderTest, NonHTTPPingTarget) {
95 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html")); 98 setDocumentURL(KURL(ParsedURLString, "http://127.0.0.1:8000/foo.html"));
96 const ResourceRequest& pingRequest = 99 const ResourceRequest& pingRequest =
97 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html")); 100 pingAndGetRequest(KURL(ParsedURLString, "ftp://localhost/bar.html"));
98 ASSERT_TRUE(pingRequest.isNull()); 101 ASSERT_TRUE(pingRequest.isNull());
99 } 102 }
100 103
101 } // namespace 104 } // namespace
102 105
103 } // namespace blink 106 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698