OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |