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

Side by Side Diff: Source/platform/network/ResourceRequestTest.cpp

Issue 1143083002: Implement request's redirect mode and RequestRedirect for Fetch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « Source/platform/network/ResourceRequest.cpp ('k') | public/platform/WebServiceWorkerRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "ResourceRequest.h" 6 #include "ResourceRequest.h"
7 7
8 #include "platform/network/FormData.h" 8 #include "platform/network/FormData.h"
9 #include "platform/weborigin/KURL.h" 9 #include "platform/weborigin/KURL.h"
10 #include "platform/weborigin/Referrer.h" 10 #include "platform/weborigin/Referrer.h"
(...skipping 22 matching lines...) Expand all
33 original.setReportUploadProgress(false); 33 original.setReportUploadProgress(false);
34 original.setHasUserGesture(false); 34 original.setHasUserGesture(false);
35 original.setDownloadToFile(false); 35 original.setDownloadToFile(false);
36 original.setSkipServiceWorker(false); 36 original.setSkipServiceWorker(false);
37 original.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); 37 original.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS);
38 original.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeSameOrig in); 38 original.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeSameOrig in);
39 original.setRequestorID(30); 39 original.setRequestorID(30);
40 original.setRequestorProcessID(40); 40 original.setRequestorProcessID(40);
41 original.setAppCacheHostID(50); 41 original.setAppCacheHostID(50);
42 original.setRequestContext(WebURLRequest::RequestContextAudio); 42 original.setRequestContext(WebURLRequest::RequestContextAudio);
43 original.setFetchRedirectMode(WebURLRequest::FetchRedirectModeFollow);
43 original.setFrameType(WebURLRequest::FrameTypeNested); 44 original.setFrameType(WebURLRequest::FrameTypeNested);
44 original.setHTTPReferrer(Referrer("http://www.example.com/referrer.htm", Ref errerPolicyDefault)); 45 original.setHTTPReferrer(Referrer("http://www.example.com/referrer.htm", Ref errerPolicyDefault));
45 46
46 EXPECT_STREQ("http://www.example.com/test.htm", original.url().string().utf8 ().data()); 47 EXPECT_STREQ("http://www.example.com/test.htm", original.url().string().utf8 ().data());
47 EXPECT_EQ(UseProtocolCachePolicy, original.cachePolicy()); 48 EXPECT_EQ(UseProtocolCachePolicy, original.cachePolicy());
48 EXPECT_EQ(10, original.timeoutInterval()); 49 EXPECT_EQ(10, original.timeoutInterval());
49 EXPECT_STREQ("http://www.example.com/first_party.htm", original.firstPartyFo rCookies().string().utf8().data()); 50 EXPECT_STREQ("http://www.example.com/first_party.htm", original.firstPartyFo rCookies().string().utf8().data());
50 EXPECT_STREQ("www.example.com", original.requestorOrigin()->host().utf8().da ta()); 51 EXPECT_STREQ("www.example.com", original.requestorOrigin()->host().utf8().da ta());
51 EXPECT_STREQ("GET", original.httpMethod().utf8().data()); 52 EXPECT_STREQ("GET", original.httpMethod().utf8().data());
52 EXPECT_STREQ("Bar", original.httpHeaderFields().get("Foo").utf8().data()); 53 EXPECT_STREQ("Bar", original.httpHeaderFields().get("Foo").utf8().data());
53 EXPECT_STREQ("Fuga", original.httpHeaderFields().get("Piyo").utf8().data()); 54 EXPECT_STREQ("Fuga", original.httpHeaderFields().get("Piyo").utf8().data());
54 EXPECT_EQ(ResourceLoadPriorityLow, original.priority()); 55 EXPECT_EQ(ResourceLoadPriorityLow, original.priority());
55 EXPECT_STREQ("Test Body", original.httpBody()->flattenToString().utf8().data ()); 56 EXPECT_STREQ("Test Body", original.httpBody()->flattenToString().utf8().data ());
56 EXPECT_FALSE(original.allowStoredCredentials()); 57 EXPECT_FALSE(original.allowStoredCredentials());
57 EXPECT_FALSE(original.reportUploadProgress()); 58 EXPECT_FALSE(original.reportUploadProgress());
58 EXPECT_FALSE(original.hasUserGesture()); 59 EXPECT_FALSE(original.hasUserGesture());
59 EXPECT_FALSE(original.downloadToFile()); 60 EXPECT_FALSE(original.downloadToFile());
60 EXPECT_FALSE(original.skipServiceWorker()); 61 EXPECT_FALSE(original.skipServiceWorker());
61 EXPECT_EQ(WebURLRequest::FetchRequestModeCORS, original.fetchRequestMode()); 62 EXPECT_EQ(WebURLRequest::FetchRequestModeCORS, original.fetchRequestMode());
62 EXPECT_EQ(WebURLRequest::FetchCredentialsModeSameOrigin, original.fetchCrede ntialsMode()); 63 EXPECT_EQ(WebURLRequest::FetchCredentialsModeSameOrigin, original.fetchCrede ntialsMode());
63 EXPECT_EQ(30, original.requestorID()); 64 EXPECT_EQ(30, original.requestorID());
64 EXPECT_EQ(40, original.requestorProcessID()); 65 EXPECT_EQ(40, original.requestorProcessID());
65 EXPECT_EQ(50, original.appCacheHostID()); 66 EXPECT_EQ(50, original.appCacheHostID());
66 EXPECT_EQ(WebURLRequest::RequestContextAudio, original.requestContext()); 67 EXPECT_EQ(WebURLRequest::RequestContextAudio, original.requestContext());
68 EXPECT_EQ(WebURLRequest::FetchRedirectModeFollow, original.fetchRedirectMode ());
67 EXPECT_EQ(WebURLRequest::FrameTypeNested, original.frameType()); 69 EXPECT_EQ(WebURLRequest::FrameTypeNested, original.frameType());
68 EXPECT_STREQ("http://www.example.com/referrer.htm", original.httpReferrer(). utf8().data()); 70 EXPECT_STREQ("http://www.example.com/referrer.htm", original.httpReferrer(). utf8().data());
69 EXPECT_EQ(ReferrerPolicyDefault, original.referrerPolicy()); 71 EXPECT_EQ(ReferrerPolicyDefault, original.referrerPolicy());
70 72
71 OwnPtr<CrossThreadResourceRequestData> data1(original.copyData()); 73 OwnPtr<CrossThreadResourceRequestData> data1(original.copyData());
72 OwnPtr<ResourceRequest> copy1(ResourceRequest::adopt(data1.release())); 74 OwnPtr<ResourceRequest> copy1(ResourceRequest::adopt(data1.release()));
73 75
74 EXPECT_STREQ("http://www.example.com/test.htm", copy1->url().string().utf8() .data()); 76 EXPECT_STREQ("http://www.example.com/test.htm", copy1->url().string().utf8() .data());
75 EXPECT_EQ(UseProtocolCachePolicy, copy1->cachePolicy()); 77 EXPECT_EQ(UseProtocolCachePolicy, copy1->cachePolicy());
76 EXPECT_EQ(10, copy1->timeoutInterval()); 78 EXPECT_EQ(10, copy1->timeoutInterval());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 { 120 {
119 ResourceRequest original; 121 ResourceRequest original;
120 EXPECT_FALSE(original.hasUserGesture()); 122 EXPECT_FALSE(original.hasUserGesture());
121 original.setHasUserGesture(true); 123 original.setHasUserGesture(true);
122 EXPECT_TRUE(original.hasUserGesture()); 124 EXPECT_TRUE(original.hasUserGesture());
123 original.setHasUserGesture(false); 125 original.setHasUserGesture(false);
124 EXPECT_TRUE(original.hasUserGesture()); 126 EXPECT_TRUE(original.hasUserGesture());
125 } 127 }
126 128
127 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/network/ResourceRequest.cpp ('k') | public/platform/WebServiceWorkerRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698