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

Unified Diff: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp

Issue 1836283002: Implement HTMLCanvasElement's transferControlToOffscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update interface layout tests result Created 4 years, 9 months 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/canvas/HTMLCanvasElementModuleTest.cpp
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4e3566f905e59d1cb332fd2e4a662f1942f27dac
--- /dev/null
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
@@ -0,0 +1,43 @@
+// Copyright 2016 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 "modules/canvas/HTMLCanvasElementModule.h"
+
+#include "core/frame/FrameView.h"
+#include "core/html/HTMLCanvasElement.h"
+#include "core/html/HTMLDocument.h"
+#include "core/loader/EmptyClients.h"
+#include "core/testing/DummyPageHolder.h"
+#include "modules/offscreencanvas/OffscreenCanvas.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+class HTMLCanvasElementModuleTest : public ::testing::Test {
+protected:
+ virtual void SetUp()
+ {
+ Page::PageClients pageClients;
+ fillWithEmptyClients(pageClients);
+ OwnPtr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients);
+ RefPtrWillBePersistent<HTMLDocument> m_document = toHTMLDocument(&m_dummyPageHolder->document());
+ m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas></body>", ASSERT_NO_EXCEPTION);
+ m_document->view()->updateAllLifecyclePhases();
+ m_canvasElement = toHTMLCanvasElement(m_document->getElementById("c"));
+ }
+
+ HTMLCanvasElement& canvasElement() const { return *m_canvasElement; }
+private:
+ RefPtrWillBePersistent<HTMLCanvasElement> m_canvasElement;
+};
+
+TEST_F(HTMLCanvasElementModuleTest, TransferControlToOffscreen)
+{
+ NonThrowableExceptionState exceptionState;
+ OffscreenCanvas* offscreenCanvas = HTMLCanvasElementModule::transferControlToOffscreen(canvasElement(), exceptionState);
+ HTMLCanvasElement* canvas = offscreenCanvas->getAssociatedCanvas();
+ EXPECT_EQ(canvas, canvasElement());
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.idl ('k') | third_party/WebKit/Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698