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

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

Issue 2736623002: Revert "Do not reuse a loading resource associated with another fetcher"
Patch Set: rebase Created 3 years, 8 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 ASSERT_TRUE(resource); 653 ASSERT_TRUE(resource);
654 EXPECT_TRUE(resource->IsLinkPreload()); 654 EXPECT_TRUE(resource->IsLinkPreload());
655 EXPECT_FALSE(fetcher->IsFetching()); 655 EXPECT_FALSE(fetcher->IsFetching());
656 fetcher->PreloadStarted(resource); 656 fetcher->PreloadStarted(resource);
657 657
658 // Resource created by parser on the second fetcher 658 // Resource created by parser on the second fetcher
659 FetchRequest fetch_request2 = FetchRequest(url, FetchInitiatorInfo()); 659 FetchRequest fetch_request2 = FetchRequest(url, FetchInitiatorInfo());
660 Resource* new_resource2 = MockResource::Fetch(fetch_request2, fetcher2); 660 Resource* new_resource2 = MockResource::Fetch(fetch_request2, fetcher2);
661 Persistent<MockResourceClient> client2 = 661 Persistent<MockResourceClient> client2 =
662 new MockResourceClient(new_resource2); 662 new MockResourceClient(new_resource2);
663 EXPECT_NE(resource, new_resource2); 663 EXPECT_EQ(resource, new_resource2);
664 EXPECT_FALSE(fetcher2->IsFetching()); 664 EXPECT_FALSE(fetcher2->IsFetching());
665 Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); 665 Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
666 } 666 }
667 667
668 TEST_F(ResourceFetcherTest, ContentTypeDataURL) { 668 TEST_F(ResourceFetcherTest, ContentTypeDataURL) {
669 ResourceFetcher* fetcher = ResourceFetcher::Create(Context()); 669 ResourceFetcher* fetcher = ResourceFetcher::Create(Context());
670 FetchRequest fetch_request = 670 FetchRequest fetch_request =
671 FetchRequest(KURL(kParsedURLString, "data:text/testmimetype,foo"), 671 FetchRequest(KURL(kParsedURLString, "data:text/testmimetype,foo"),
672 FetchInitiatorInfo()); 672 FetchInitiatorInfo());
673 Resource* resource = MockResource::Fetch(fetch_request, fetcher); 673 Resource* resource = MockResource::Fetch(fetch_request, fetcher);
674 ASSERT_TRUE(resource); 674 ASSERT_TRUE(resource);
675 EXPECT_EQ(ResourceStatus::kCached, resource->GetStatus()); 675 EXPECT_EQ(ResourceStatus::kCached, resource->GetStatus());
676 EXPECT_EQ("text/testmimetype", resource->GetResponse().MimeType()); 676 EXPECT_EQ("text/testmimetype", resource->GetResponse().MimeType());
677 EXPECT_EQ("text/testmimetype", resource->GetResponse().HttpContentType()); 677 EXPECT_EQ("text/testmimetype", resource->GetResponse().HttpContentType());
678 } 678 }
679 679
680 } // namespace blink 680 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698