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

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

Issue 2533683002: Move the code in ResourceFetcher handling calls from WebURLLoaderImpl to ResourceLoader (Closed)
Patch Set: Fix test Created 4 years 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(navigationTimingInfo->transferSize(), encodedDataLength); 171 EXPECT_EQ(navigationTimingInfo->transferSize(), encodedDataLength);
172 172
173 // When there are redirects. 173 // When there are redirects.
174 KURL redirectURL(ParsedURLString, "http://127.0.0.1:8000/redirect.html"); 174 KURL redirectURL(ParsedURLString, "http://127.0.0.1:8000/redirect.html");
175 ResourceResponse redirectResponse; 175 ResourceResponse redirectResponse;
176 redirectResponse.setURL(redirectURL); 176 redirectResponse.setURL(redirectURL);
177 redirectResponse.setHTTPStatusCode(200); 177 redirectResponse.setHTTPStatusCode(200);
178 long long redirectEncodedDataLength = 123; 178 long long redirectEncodedDataLength = 123;
179 redirectResponse.setEncodedDataLength(redirectEncodedDataLength); 179 redirectResponse.setEncodedDataLength(redirectEncodedDataLength);
180 ResourceRequest redirectResourceRequest(url); 180 ResourceRequest redirectResourceRequest(url);
181 fetcher->willFollowRedirect(resource, redirectResourceRequest, 181 fetcher->recordResourceTimingOnRedirect(resource, redirectResponse, false);
182 redirectResponse);
183 EXPECT_EQ(navigationTimingInfo->transferSize(), 182 EXPECT_EQ(navigationTimingInfo->transferSize(),
184 encodedDataLength + redirectEncodedDataLength); 183 encodedDataLength + redirectEncodedDataLength);
185 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); 184 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
186 } 185 }
187 186
188 TEST_F(ResourceFetcherTest, VaryOnBack) { 187 TEST_F(ResourceFetcherTest, VaryOnBack) {
189 MockFetchContext* context = 188 MockFetchContext* context =
190 MockFetchContext::create(MockFetchContext::kShouldLoadNewResource); 189 MockFetchContext::create(MockFetchContext::kShouldLoadNewResource);
191 context->setCachePolicy(CachePolicyHistoryBuffer); 190 context->setCachePolicy(CachePolicyHistoryBuffer);
192 ResourceFetcher* fetcher = ResourceFetcher::create(context); 191 ResourceFetcher* fetcher = ResourceFetcher::create(context);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 FetchRequest fetchRequest2 = FetchRequest(url, FetchInitiatorInfo()); 675 FetchRequest fetchRequest2 = FetchRequest(url, FetchInitiatorInfo());
677 Resource* newResource2 = ImageResource::fetch(fetchRequest2, fetcher2); 676 Resource* newResource2 = ImageResource::fetch(fetchRequest2, fetcher2);
678 Persistent<MockResourceClient> client2 = new MockResourceClient(newResource2); 677 Persistent<MockResourceClient> client2 = new MockResourceClient(newResource2);
679 EXPECT_EQ(resource, newResource2); 678 EXPECT_EQ(resource, newResource2);
680 EXPECT_FALSE(fetcher2->isFetching()); 679 EXPECT_FALSE(fetcher2->isFetching());
681 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); 680 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
682 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); 681 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
683 } 682 }
684 683
685 } // namespace blink 684 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698