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 "config.h" | 31 #include "config.h" |
32 #include "core/fetch/ResourceFetcher.h" | 32 #include "core/fetch/ResourceFetcher.h" |
33 | 33 |
34 #include "core/fetch/FetchInitiatorInfo.h" | 34 #include "core/fetch/FetchInitiatorInfo.h" |
35 #include "core/fetch/FetchRequest.h" | 35 #include "core/fetch/FetchRequest.h" |
36 #include "core/fetch/ImageResource.h" | 36 #include "core/fetch/ImageResource.h" |
37 #include "core/fetch/MemoryCache.h" | 37 #include "core/fetch/MemoryCache.h" |
38 #include "core/fetch/ResourcePtr.h" | 38 #include "core/fetch/ResourcePtr.h" |
| 39 #include "platform/heap/Handle.h" |
39 #include "platform/network/ResourceRequest.h" | 40 #include "platform/network/ResourceRequest.h" |
40 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
41 #include <gtest/gtest.h> | 42 #include <gtest/gtest.h> |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class ResourceFetcherTest : public ::testing::Test { | 46 class ResourceFetcherTest : public ::testing::Test { |
46 }; | 47 }; |
47 | 48 |
48 TEST_F(ResourceFetcherTest, StartLoadAfterFrameDetach) | 49 TEST_F(ResourceFetcherTest, StartLoadAfterFrameDetach) |
49 { | 50 { |
50 KURL secureURL(ParsedURLString, "https://secureorigin.test/image.png"); | 51 KURL secureURL(ParsedURLString, "https://secureorigin.test/image.png"); |
51 // Try to request a url. The request should fail, no resource should be retu
rned, | 52 // Try to request a url. The request should fail, no resource should be retu
rned, |
52 // and no resource should be present in the cache. | 53 // and no resource should be present in the cache. |
53 RefPtr<ResourceFetcher> fetcher = ResourceFetcher::create(FetchContext::crea
te()); | 54 RefPtrWillBeRawPtr<ResourceFetcher> fetcher = ResourceFetcher::create(FetchC
ontext::create()); |
54 FetchRequest fetchRequest = FetchRequest(ResourceRequest(secureURL), FetchIn
itiatorInfo()); | 55 FetchRequest fetchRequest = FetchRequest(ResourceRequest(secureURL), FetchIn
itiatorInfo()); |
55 ResourcePtr<ImageResource> image = fetcher->fetchImage(fetchRequest); | 56 ResourcePtr<ImageResource> image = fetcher->fetchImage(fetchRequest); |
56 EXPECT_EQ(image.get(), static_cast<ImageResource*>(0)); | 57 EXPECT_EQ(image.get(), static_cast<ImageResource*>(0)); |
57 EXPECT_EQ(memoryCache()->resourceForURL(secureURL), static_cast<Resource*>(0
)); | 58 EXPECT_EQ(memoryCache()->resourceForURL(secureURL), static_cast<Resource*>(0
)); |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace blink |
OLD | NEW |