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

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

Issue 1987413002: Add link preload as=document support Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: crash fix Created 4 years, 3 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 public: 67 public:
68 static ResourceFetcherTestMockFetchContext* create() 68 static ResourceFetcherTestMockFetchContext* create()
69 { 69 {
70 return new ResourceFetcherTestMockFetchContext; 70 return new ResourceFetcherTestMockFetchContext;
71 } 71 }
72 72
73 virtual ~ResourceFetcherTestMockFetchContext() { } 73 virtual ~ResourceFetcherTestMockFetchContext() { }
74 74
75 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru e; } 75 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru e; }
76 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o verride { return true; } 76 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o verride { return true; }
77 bool shouldLoadNewResource(Resource::Type) const override { return true; } 77 bool shouldLoadNewResource(Resource::Type, const WebURLRequest::FrameType) c onst override { return true; }
78 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); } 78 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); }
79 79
80 void setCachePolicy(CachePolicy policy) { m_policy = policy; } 80 void setCachePolicy(CachePolicy policy) { m_policy = policy; }
81 CachePolicy getCachePolicy() const override { return m_policy; } 81 CachePolicy getCachePolicy() const override { return m_policy; }
82 void setLoadComplete(bool complete) { m_complete = complete; } 82 void setLoadComplete(bool complete) { m_complete = complete; }
83 bool isLoadComplete() const override { return m_complete; } 83 bool isLoadComplete() const override { return m_complete; }
84 84
85 void addResourceTiming(const ResourceTimingInfo& resourceTimingInfo) overrid e { m_transferSize = resourceTimingInfo.transferSize(); } 85 void addResourceTiming(const ResourceTimingInfo& resourceTimingInfo) overrid e { m_transferSize = resourceTimingInfo.transferSize(); }
86 long long getTransferSize() const { return m_transferSize; } 86 long long getTransferSize() const { return m_transferSize; }
87 87
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 FetchRequest request(url, FetchInitiatorInfo()); 510 FetchRequest request(url, FetchInitiatorInfo());
511 request.makeSynchronous(); 511 request.makeSynchronous();
512 Resource* resource = fetcher->requestResource(request, TestResourceFactory() ); 512 Resource* resource = fetcher->requestResource(request, TestResourceFactory() );
513 EXPECT_TRUE(resource->isLoaded()); 513 EXPECT_TRUE(resource->isLoaded());
514 EXPECT_EQ(ResourceLoadPriorityHighest, resource->resourceRequest().priority( )); 514 EXPECT_EQ(ResourceLoadPriorityHighest, resource->resourceRequest().priority( ));
515 515
516 memoryCache()->remove(resource); 516 memoryCache()->remove(resource);
517 } 517 }
518 518
519 } // namespace blink 519 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698