Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp

Issue 1455763002: Use union type in ImageBitmapFactories.idl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better argument passing Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
deleted file mode 100644
index 033678e9b5777ed819d0be878f974067a8abbd9c..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "core/frame/ImageBitmap.h"
-
-#include "bindings/core/v8/UnionTypesCore.h"
-#include "core/dom/Document.h"
-#include "core/fetch/MemoryCache.h"
-#include "core/html/HTMLCanvasElement.h"
-#include "modules/canvas2d/CanvasRenderingContext2D.h"
-#include "platform/heap/Handle.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace blink {
-
-class ImageBitmapModuleTest : public ::testing::Test {
-protected:
- virtual void SetUp()
- {
- // Save the global memory cache to restore it upon teardown.
- m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create());
- }
- virtual void TearDown()
- {
- // Garbage collection is required prior to switching out the
- // test's memory cache; image resources are released, evicting
- // them from the cache.
- Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC);
-
- replaceMemoryCacheForTesting(m_globalMemoryCache.release());
- }
-
- Persistent<MemoryCache> m_globalMemoryCache;
-};
-
-// Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
-TEST_F(ImageBitmapModuleTest, ImageResourceLifetime)
-{
- RefPtrWillBeRawPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::create(*Document::create().get());
- canvasElement->setHeight(40);
- canvasElement->setWidth(40);
- RefPtrWillBeRawPtr<ImageBitmap> imageBitmapDerived = nullptr;
- {
- RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::create(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->height()));
- imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), IntRect(0, 0, 20, 20));
- }
- CanvasContextCreationAttributes attributes;
- CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(canvasElement->getCanvasRenderingContext("2d", attributes));
- TrackExceptionState exceptionState;
- CanvasImageSourceUnion imageSource;
- imageSource.setImageBitmap(imageBitmapDerived);
- context->drawImage(imageSource, 0, 0, exceptionState);
-}
-
-} // namespace

Powered by Google App Engine
This is Rietveld 408576698