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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class ResourceFetcherTestMockFetchContext : public FetchContext { | 49 class ResourceFetcherTestMockFetchContext : public FetchContext { |
50 public: | 50 public: |
51 static ResourceFetcherTestMockFetchContext* create() | 51 static ResourceFetcherTestMockFetchContext* create() |
52 { | 52 { |
53 return new ResourceFetcherTestMockFetchContext; | 53 return new ResourceFetcherTestMockFetchContext; |
54 } | 54 } |
55 | 55 |
56 virtual ~ResourceFetcherTestMockFetchContext() { } | 56 virtual ~ResourceFetcherTestMockFetchContext() { } |
57 | 57 |
58 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru
e; } | 58 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru
e; } |
59 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R
esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o
verride { return true; } | 59 bool canRequest(Resource::Type, ResourceRequest&, const KURL&, const Resourc
eLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const overrid
e { return true; } |
60 bool shouldLoadNewResource(Resource::Type) const override { return true; } | 60 bool shouldLoadNewResource(Resource::Type) const override { return true; } |
61 | 61 |
62 void setCachePolicy(CachePolicy policy) { m_policy = policy; } | 62 void setCachePolicy(CachePolicy policy) { m_policy = policy; } |
63 CachePolicy cachePolicy() const override { return m_policy; } | 63 CachePolicy cachePolicy() const override { return m_policy; } |
64 | 64 |
65 private: | 65 private: |
66 ResourceFetcherTestMockFetchContext() | 66 ResourceFetcherTestMockFetchContext() |
67 : m_policy(CachePolicyVerify) | 67 : m_policy(CachePolicyVerify) |
68 { } | 68 { } |
69 | 69 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 ResourceFetcherTestMockFetchContext* context = ResourceFetcherTestMockFetchC
ontext::create(); | 190 ResourceFetcherTestMockFetchContext* context = ResourceFetcherTestMockFetchC
ontext::create(); |
191 context->setCachePolicy(CachePolicyRevalidate); | 191 context->setCachePolicy(CachePolicyRevalidate); |
192 ResourceFetcher* fetcher2 = ResourceFetcher::create(context); | 192 ResourceFetcher* fetcher2 = ResourceFetcher::create(context); |
193 FetchRequest fetchRequest2(url, FetchInitiatorInfo()); | 193 FetchRequest fetchRequest2(url, FetchInitiatorInfo()); |
194 ResourcePtr<Resource> resource2 = fetcher2->requestResource(fetchRequest2, T
estResourceFactory()); | 194 ResourcePtr<Resource> resource2 = fetcher2->requestResource(fetchRequest2, T
estResourceFactory()); |
195 EXPECT_EQ(resource1, resource2); | 195 EXPECT_EQ(resource1, resource2); |
196 } | 196 } |
197 | 197 |
198 } // namespace blink | 198 } // namespace blink |
OLD | NEW |