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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return new ResourceFetcherTestMockFetchContext; | 54 return new ResourceFetcherTestMockFetchContext; |
55 } | 55 } |
56 | 56 |
57 virtual ~ResourceFetcherTestMockFetchContext() { } | 57 virtual ~ResourceFetcherTestMockFetchContext() { } |
58 | 58 |
59 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru
e; } | 59 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru
e; } |
60 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R
esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o
verride { return true; } | 60 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R
esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o
verride { return true; } |
61 bool shouldLoadNewResource(Resource::Type) const override { return true; } | 61 bool shouldLoadNewResource(Resource::Type) const override { return true; } |
62 | 62 |
63 void setCachePolicy(CachePolicy policy) { m_policy = policy; } | 63 void setCachePolicy(CachePolicy policy) { m_policy = policy; } |
64 CachePolicy cachePolicy() const override { return m_policy; } | 64 CachePolicy getCachePolicy() const override { return m_policy; } |
65 | 65 |
66 private: | 66 private: |
67 ResourceFetcherTestMockFetchContext() | 67 ResourceFetcherTestMockFetchContext() |
68 : m_policy(CachePolicyVerify) | 68 : m_policy(CachePolicyVerify) |
69 { } | 69 { } |
70 | 70 |
71 CachePolicy m_policy; | 71 CachePolicy m_policy; |
72 }; | 72 }; |
73 | 73 |
74 class ResourceFetcherTest : public ::testing::Test { | 74 class ResourceFetcherTest : public ::testing::Test { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 ResourceLoaderOptions options; | 231 ResourceLoaderOptions options; |
232 options.dataBufferingPolicy = DoNotBufferData; | 232 options.dataBufferingPolicy = DoNotBufferData; |
233 FetchRequest fetchRequest = FetchRequest(request, FetchInitiatorTypeNames::i
nternal, options); | 233 FetchRequest fetchRequest = FetchRequest(request, FetchInitiatorTypeNames::i
nternal, options); |
234 RefPtrWillBeRawPtr<Resource> resource1 = fetcher->requestResource(fetchReque
st, TestResourceFactory(Resource::Media)); | 234 RefPtrWillBeRawPtr<Resource> resource1 = fetcher->requestResource(fetchReque
st, TestResourceFactory(Resource::Media)); |
235 RefPtrWillBeRawPtr<Resource> resource2 = fetcher->requestResource(fetchReque
st, TestResourceFactory(Resource::Media)); | 235 RefPtrWillBeRawPtr<Resource> resource2 = fetcher->requestResource(fetchReque
st, TestResourceFactory(Resource::Media)); |
236 EXPECT_NE(resource1.get(), resource2.get()); | 236 EXPECT_NE(resource1.get(), resource2.get()); |
237 memoryCache()->remove(resource2.get()); | 237 memoryCache()->remove(resource2.get()); |
238 } | 238 } |
239 | 239 |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |