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

Side by Side Diff: third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 { 115 {
116 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequest s(); 116 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequest s();
117 } 117 }
118 118
119 std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOp tions options = WebURLLoaderOptions()) 119 std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOp tions options = WebURLLoaderOptions())
120 { 120 {
121 return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); 121 return wrapUnique(mainFrame()->createAssociatedURLLoader(options));
122 } 122 }
123 123
124 // WebURLLoaderClient implementation. 124 // WebURLLoaderClient implementation.
125 void willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, con st WebURLResponse& redirectResponse, int64_t encodedDataLength) override 125 bool willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, con st WebURLResponse& redirectResponse, int64_t encodedDataLength) override
126 { 126 {
127 m_willFollowRedirect = true; 127 m_willFollowRedirect = true;
128 EXPECT_EQ(m_expectedLoader.get(), loader); 128 EXPECT_EQ(m_expectedLoader.get(), loader);
129 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); 129 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url());
130 // Check that CORS simple headers are transferred to the new request. 130 // Check that CORS simple headers are transferred to the new request.
131 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.htt pHeaderField("accept")); 131 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.htt pHeaderField("accept"));
132 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url()); 132 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url());
133 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(), redirectResponse. httpStatusCode()); 133 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(), redirectResponse. httpStatusCode());
134 EXPECT_EQ(m_expectedRedirectResponse.mimeType(), redirectResponse.mimeTy pe()); 134 EXPECT_EQ(m_expectedRedirectResponse.mimeType(), redirectResponse.mimeTy pe());
135 return true;
135 } 136 }
136 137
137 void didSendData(WebURLLoader* loader, unsigned long long bytesSent, unsigne d long long totalBytesToBeSent) override 138 void didSendData(WebURLLoader* loader, unsigned long long bytesSent, unsigne d long long totalBytesToBeSent) override
138 { 139 {
139 m_didSendData = true; 140 m_didSendData = true;
140 EXPECT_EQ(m_expectedLoader.get(), loader); 141 EXPECT_EQ(m_expectedLoader.get(), loader);
141 } 142 }
142 143
143 void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response ) override 144 void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response ) override
144 { 145 {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 m_expectedLoader->loadAsynchronously(request, this); 681 m_expectedLoader->loadAsynchronously(request, this);
681 serveRequests(); 682 serveRequests();
682 EXPECT_TRUE(m_didReceiveResponse); 683 EXPECT_TRUE(m_didReceiveResponse);
683 EXPECT_TRUE(m_didReceiveData); 684 EXPECT_TRUE(m_didReceiveData);
684 EXPECT_TRUE(m_didFinishLoading); 685 EXPECT_TRUE(m_didFinishLoading);
685 686
686 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); 687 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
687 } 688 }
688 689
689 } // namespace blink 690 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698