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

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, 2 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void serveRequests() { 111 void serveRequests() {
112 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); 112 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
113 } 113 }
114 114
115 std::unique_ptr<WebURLLoader> createAssociatedURLLoader( 115 std::unique_ptr<WebURLLoader> createAssociatedURLLoader(
116 const WebURLLoaderOptions options = WebURLLoaderOptions()) { 116 const WebURLLoaderOptions options = WebURLLoaderOptions()) {
117 return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); 117 return wrapUnique(mainFrame()->createAssociatedURLLoader(options));
118 } 118 }
119 119
120 // WebURLLoaderClient implementation. 120 // WebURLLoaderClient implementation.
121 void willFollowRedirect(WebURLLoader* loader, 121 bool willFollowRedirect(WebURLLoader* loader,
122 WebURLRequest& newRequest, 122 WebURLRequest& newRequest,
123 const WebURLResponse& redirectResponse) override { 123 const WebURLResponse& redirectResponse) override {
124 m_willFollowRedirect = true; 124 m_willFollowRedirect = true;
125 EXPECT_EQ(m_expectedLoader.get(), loader); 125 EXPECT_EQ(m_expectedLoader.get(), loader);
126 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); 126 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url());
127 // Check that CORS simple headers are transferred to the new request. 127 // Check that CORS simple headers are transferred to the new request.
128 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), 128 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"),
129 newRequest.httpHeaderField("accept")); 129 newRequest.httpHeaderField("accept"));
130 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url()); 130 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url());
131 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(), 131 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(),
132 redirectResponse.httpStatusCode()); 132 redirectResponse.httpStatusCode());
133 EXPECT_EQ(m_expectedRedirectResponse.mimeType(), 133 EXPECT_EQ(m_expectedRedirectResponse.mimeType(),
134 redirectResponse.mimeType()); 134 redirectResponse.mimeType());
135 return true;
135 } 136 }
136 137
137 void didSendData(WebURLLoader* loader, 138 void didSendData(WebURLLoader* loader,
138 unsigned long long bytesSent, 139 unsigned long long bytesSent,
139 unsigned long long totalBytesToBeSent) override { 140 unsigned long long totalBytesToBeSent) override {
140 m_didSendData = true; 141 m_didSendData = true;
141 EXPECT_EQ(m_expectedLoader.get(), loader); 142 EXPECT_EQ(m_expectedLoader.get(), loader);
142 } 143 }
143 144
144 void didReceiveResponse(WebURLLoader* loader, 145 void didReceiveResponse(WebURLLoader* loader,
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 m_expectedLoader->loadAsynchronously(request, this); 713 m_expectedLoader->loadAsynchronously(request, this);
713 serveRequests(); 714 serveRequests();
714 EXPECT_TRUE(m_didReceiveResponse); 715 EXPECT_TRUE(m_didReceiveResponse);
715 EXPECT_TRUE(m_didReceiveData); 716 EXPECT_TRUE(m_didReceiveData);
716 EXPECT_TRUE(m_didFinishLoading); 717 EXPECT_TRUE(m_didFinishLoading);
717 718
718 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); 719 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
719 } 720 }
720 721
721 } // namespace blink 722 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/AssociatedURLLoader.cpp ('k') | third_party/WebKit/public/platform/WebURLLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698