| Index: Source/core/loader/cache/ResourceFetcherTest.cpp
|
| diff --git a/Source/core/animation/AnimatableNeutralTest.cpp b/Source/core/loader/cache/ResourceFetcherTest.cpp
|
| similarity index 50%
|
| copy from Source/core/animation/AnimatableNeutralTest.cpp
|
| copy to Source/core/loader/cache/ResourceFetcherTest.cpp
|
| index 0eb0188666d28d1cb73d6699b85ae7f2766a0622..2f99f94905fb59160331d66ba4032ac8238462e3 100644
|
| --- a/Source/core/animation/AnimatableNeutralTest.cpp
|
| +++ b/Source/core/loader/cache/ResourceFetcherTest.cpp
|
| @@ -29,29 +29,40 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "core/animation/AnimatableNeutral.h"
|
| -
|
| -#include "core/animation/AnimatableUnknown.h"
|
| -#include "core/css/CSSArrayFunctionValue.h"
|
| +#include "core/loader/cache/ResourceFetcher.h"
|
|
|
| +#include "core/html/HTMLDocument.h"
|
| +#include "core/loader/DocumentLoader.h"
|
| +#include "core/loader/cache/CachedResourceHandle.h"
|
| +#include "core/loader/cache/CachedResourceInitiatorInfo.h"
|
| +#include "core/loader/cache/FetchRequest.h"
|
| +#include "core/loader/cache/MemoryCache.h"
|
| +#include "core/platform/network/ResourceRequest.h"
|
| #include <gtest/gtest.h>
|
|
|
| using namespace WebCore;
|
|
|
| namespace {
|
|
|
| -TEST(AnimatableNeutral, Create)
|
| +TEST(ResourceFetcherTest, StartLoadAfterFrameDetach)
|
| {
|
| - EXPECT_TRUE(AnimatableValue::neutralValue());
|
| -}
|
| + KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.jpg");
|
|
|
| -TEST(AnimatableNeutral, Add)
|
| -{
|
| - RefPtr<CSSValue> cssValue = CSSArrayFunctionValue::create();
|
| - RefPtr<AnimatableValue> animatableUnknown = AnimatableUnknown::create(cssValue);
|
| + // Create a ResourceFetcher that has a real DocumentLoader and Document, but is not attached to a Frame.
|
| + // Technically, we're concerned about what happens after a Frame is detached (rather than before
|
| + // any attach occurs), but ResourceFetcher can't tell the difference.
|
| + RefPtr<DocumentLoader> documentLoader = DocumentLoader::create(ResourceRequest(testURL), SubstituteData());
|
| + RefPtr<HTMLDocument> document = HTMLDocument::create();
|
| + RefPtr<ResourceFetcher> fetcher(documentLoader->fetcher());
|
| + fetcher->setDocument(document.get());
|
| + EXPECT_EQ(fetcher->frame(), static_cast<Frame*>(0));
|
|
|
| - EXPECT_EQ(cssValue, AnimatableValue::add(animatableUnknown.get(), AnimatableValue::neutralValue())->toCSSValue());
|
| - EXPECT_EQ(cssValue, AnimatableValue::add(AnimatableValue::neutralValue(), animatableUnknown.get())->toCSSValue());
|
| + // Try to request a url. The request should fail, no resource should be returned,
|
| + // and no resource should be present in the cache.
|
| + FetchRequest fetchRequest = FetchRequest(ResourceRequest(testURL), CachedResourceInitiatorInfo());
|
| + CachedResourceHandle<CachedImage> image = fetcher->requestImage(fetchRequest);
|
| + EXPECT_EQ(image.get(), static_cast<CachedImage*>(0));
|
| + EXPECT_EQ(memoryCache()->resourceForURL(testURL), static_cast<CachedResource*>(0));
|
| }
|
|
|
| -}
|
| +} // namespace
|
|
|