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" | |
40 | 39 |
41 namespace blink { | 40 namespace blink { |
42 | 41 |
43 class MemoryCacheTest : public ::testing::Test { | 42 class MemoryCacheTest : public ::testing::Test { |
44 public: | 43 public: |
45 class FakeDecodedResource : public Resource { | 44 class FakeDecodedResource : public Resource { |
46 public: | 45 public: |
47 static FakeDecodedResource* create(const ResourceRequest& request, Type
type) | 46 static FakeDecodedResource* create(const ResourceRequest& request, Type
type) |
48 { | 47 { |
49 return new FakeDecodedResource(request, type, ResourceLoaderOptions(
)); | 48 return new FakeDecodedResource(request, type, ResourceLoaderOptions(
)); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 419 |
421 HeapVector<Member<Resource>> resources = memoryCache()->resourcesForURL(url)
; | 420 HeapVector<Member<Resource>> resources = memoryCache()->resourcesForURL(url)
; |
422 EXPECT_EQ(2u, resources.size()); | 421 EXPECT_EQ(2u, resources.size()); |
423 | 422 |
424 memoryCache()->evictResources(); | 423 memoryCache()->evictResources(); |
425 EXPECT_FALSE(memoryCache()->contains(resource1)); | 424 EXPECT_FALSE(memoryCache()->contains(resource1)); |
426 EXPECT_FALSE(memoryCache()->contains(resource3)); | 425 EXPECT_FALSE(memoryCache()->contains(resource3)); |
427 } | 426 } |
428 | 427 |
429 } // namespace blink | 428 } // namespace blink |
OLD | NEW |