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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/canvas/HTMLCanvasElementModule.h"
6
7 #include "core/frame/FrameView.h"
8 #include "core/html/HTMLCanvasElement.h"
9 #include "core/html/HTMLDocument.h"
10 #include "core/loader/EmptyClients.h"
11 #include "core/testing/DummyPageHolder.h"
12 #include "modules/offscreencanvas/OffscreenCanvas.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace blink {
16
17 class HTMLCanvasElementModuleTest : public ::testing::Test {
18 protected:
19 virtual void SetUp()
20 {
21 Page::PageClients pageClients;
22 fillWithEmptyClients(pageClients);
23 OwnPtr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntS ize(800, 600), &pageClients);
24 RefPtrWillBePersistent<HTMLDocument> m_document = toHTMLDocument(&m_dumm yPageHolder->document());
25 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canv as></body>", ASSERT_NO_EXCEPTION);
26 m_document->view()->updateAllLifecyclePhases();
27 m_canvasElement = toHTMLCanvasElement(m_document->getElementById("c"));
28 }
29
30 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; }
31 private:
32 RefPtrWillBePersistent<HTMLCanvasElement> m_canvasElement;
33 };
34
35 TEST_F(HTMLCanvasElementModuleTest, TransferControlToOffscreen)
36 {
37 NonThrowableExceptionState exceptionState;
38 OffscreenCanvas* offscreenCanvas = HTMLCanvasElementModule::transferControlT oOffscreen(canvasElement(), exceptionState);
39 HTMLCanvasElement* canvas = offscreenCanvas->getAssociatedCanvas();
40 EXPECT_EQ(canvas, canvasElement());
41 }
42
43 } // namespace blink
OLDNEW
« 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