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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp

Issue 2835123005: Send the decoded size when response completed and stop summing in ResourceLoader::DidReceiveData() (Closed)
Patch Set: Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 url, WebURLResponse(), ""); 188 url, WebURLResponse(), "");
189 Resource* resource = 189 Resource* resource =
190 RawResource::FetchMainResource(fetch_params, fetcher, SubstituteData()); 190 RawResource::FetchMainResource(fetch_params, fetcher, SubstituteData());
191 resource->ResponseReceived(response, nullptr); 191 resource->ResponseReceived(response, nullptr);
192 EXPECT_EQ(resource->GetType(), Resource::kMainResource); 192 EXPECT_EQ(resource->GetType(), Resource::kMainResource);
193 193
194 ResourceTimingInfo* navigation_timing_info = 194 ResourceTimingInfo* navigation_timing_info =
195 fetcher->GetNavigationTimingInfo(); 195 fetcher->GetNavigationTimingInfo();
196 ASSERT_TRUE(navigation_timing_info); 196 ASSERT_TRUE(navigation_timing_info);
197 long long encoded_data_length = 123; 197 long long encoded_data_length = 123;
198 resource->Loader()->DidFinishLoading(0.0, encoded_data_length, 0); 198 resource->Loader()->DidFinishLoading(0.0, encoded_data_length, 0, 0);
199 EXPECT_EQ(navigation_timing_info->TransferSize(), encoded_data_length); 199 EXPECT_EQ(navigation_timing_info->TransferSize(), encoded_data_length);
200 200
201 // When there are redirects. 201 // When there are redirects.
202 KURL redirect_url(kParsedURLString, "http://127.0.0.1:8000/redirect.html"); 202 KURL redirect_url(kParsedURLString, "http://127.0.0.1:8000/redirect.html");
203 ResourceResponse redirect_response; 203 ResourceResponse redirect_response;
204 redirect_response.SetURL(redirect_url); 204 redirect_response.SetURL(redirect_url);
205 redirect_response.SetHTTPStatusCode(200); 205 redirect_response.SetHTTPStatusCode(200);
206 long long redirect_encoded_data_length = 123; 206 long long redirect_encoded_data_length = 123;
207 redirect_response.SetEncodedDataLength(redirect_encoded_data_length); 207 redirect_response.SetEncodedDataLength(redirect_encoded_data_length);
208 ResourceRequest redirect_resource_request(url); 208 ResourceRequest redirect_resource_request(url);
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 FetchParameters fetch_params = FetchParameters( 688 FetchParameters fetch_params = FetchParameters(
689 ResourceRequest("data:text/testmimetype,foo"), FetchInitiatorInfo()); 689 ResourceRequest("data:text/testmimetype,foo"), FetchInitiatorInfo());
690 Resource* resource = MockResource::Fetch(fetch_params, fetcher); 690 Resource* resource = MockResource::Fetch(fetch_params, fetcher);
691 ASSERT_TRUE(resource); 691 ASSERT_TRUE(resource);
692 EXPECT_EQ(ResourceStatus::kCached, resource->GetStatus()); 692 EXPECT_EQ(ResourceStatus::kCached, resource->GetStatus());
693 EXPECT_EQ("text/testmimetype", resource->GetResponse().MimeType()); 693 EXPECT_EQ("text/testmimetype", resource->GetResponse().MimeType());
694 EXPECT_EQ("text/testmimetype", resource->GetResponse().HttpContentType()); 694 EXPECT_EQ("text/testmimetype", resource->GetResponse().HttpContentType());
695 } 695 }
696 696
697 } // namespace blink 697 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698