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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "core/fetch/MemoryCache.h" | 31 #include "core/fetch/MemoryCache.h" |
32 | 32 |
33 #include "core/fetch/MockResourceClients.h" | 33 #include "core/fetch/MockResourceClients.h" |
34 #include "core/fetch/RawResource.h" | 34 #include "core/fetch/RawResource.h" |
35 #include "platform/network/ResourceRequest.h" | 35 #include "platform/network/ResourceRequest.h" |
36 #include "platform/testing/UnitTestHelpers.h" | 36 #include "platform/testing/UnitTestHelpers.h" |
37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "wtf/OwnPtr.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 class MemoryCacheTest : public ::testing::Test { | 43 class MemoryCacheTest : public ::testing::Test { |
43 public: | 44 public: |
44 class FakeDecodedResource : public Resource { | 45 class FakeDecodedResource : public Resource { |
45 public: | 46 public: |
46 static FakeDecodedResource* create(const ResourceRequest& request, Type
type) | 47 static FakeDecodedResource* create(const ResourceRequest& request, Type
type) |
47 { | 48 { |
48 return new FakeDecodedResource(request, type, ResourceLoaderOptions(
)); | 49 return new FakeDecodedResource(request, type, ResourceLoaderOptions(
)); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 420 |
420 HeapVector<Member<Resource>> resources = memoryCache()->resourcesForURL(url)
; | 421 HeapVector<Member<Resource>> resources = memoryCache()->resourcesForURL(url)
; |
421 EXPECT_EQ(2u, resources.size()); | 422 EXPECT_EQ(2u, resources.size()); |
422 | 423 |
423 memoryCache()->evictResources(); | 424 memoryCache()->evictResources(); |
424 EXPECT_FALSE(memoryCache()->contains(resource1)); | 425 EXPECT_FALSE(memoryCache()->contains(resource1)); |
425 EXPECT_FALSE(memoryCache()->contains(resource3)); | 426 EXPECT_FALSE(memoryCache()->contains(resource3)); |
426 } | 427 } |
427 | 428 |
428 } // namespace blink | 429 } // namespace blink |
OLD | NEW |