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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp

Issue 1836283002: Implement HTMLCanvasElement's transferControlToOffscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include "core/fetch/MemoryCache.h" 7 #include "core/fetch/MemoryCache.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
11 #include "core/html/HTMLDocument.h" 11 #include "core/html/HTMLDocument.h"
12 #include "core/html/ImageData.h" 12 #include "core/html/ImageData.h"
13 #include "core/imagebitmap/ImageBitmapOptions.h" 13 #include "core/imagebitmap/ImageBitmapOptions.h"
14 #include "core/loader/EmptyClients.h" 14 #include "core/loader/EmptyClients.h"
15 #include "core/testing/DummyPageHolder.h" 15 #include "core/testing/DummyPageHolder.h"
16 #include "modules/canvas/HTMLCanvasElementModule.h"
16 #include "modules/canvas2d/CanvasGradient.h" 17 #include "modules/canvas2d/CanvasGradient.h"
17 #include "modules/canvas2d/CanvasPattern.h" 18 #include "modules/canvas2d/CanvasPattern.h"
19 #include "modules/offscreencanvas/OffscreenCanvas.h"
18 #include "modules/webgl/WebGLRenderingContext.h" 20 #include "modules/webgl/WebGLRenderingContext.h"
19 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 21 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
20 #include "platform/graphics/RecordingImageBufferSurface.h" 22 #include "platform/graphics/RecordingImageBufferSurface.h"
21 #include "platform/graphics/StaticBitmapImage.h" 23 #include "platform/graphics/StaticBitmapImage.h"
22 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 24 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
23 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
25 #include "third_party/skia/include/core/SkSurface.h" 27 #include "third_party/skia/include/core/SkSurface.h"
26 28
27 using ::testing::Mock; 29 using ::testing::Mock;
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // Tear down the first image buffer that resides in current canvas element 714 // Tear down the first image buffer that resides in current canvas element
713 canvasElement().setSize(IntSize(20, 20)); 715 canvasElement().setSize(IntSize(20, 20));
714 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr); 716 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr);
715 EXPECT_EQ(400, getGlobalGPUMemoryUsage()); 717 EXPECT_EQ(400, getGlobalGPUMemoryUsage());
716 718
717 // Tear down the second image buffer 719 // Tear down the second image buffer
718 imageBuffer2.clear(); 720 imageBuffer2.clear();
719 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); 721 EXPECT_EQ(0, getGlobalGPUMemoryUsage());
720 } 722 }
721 723
724 TEST_F(CanvasRenderingContext2DTest, TransferControlToOffscreen)
Justin Novosad 2016/03/30 19:51:06 Good test, but wrong place for it. It has nothing
725 {
726 NonThrowableExceptionState exceptionState;
727 OffscreenCanvas* offscreenCanvas = HTMLCanvasElementModule::transferControlT oOffscreen(canvasElement(), exceptionState);
728 HTMLCanvasElement* canvas = offscreenCanvas->getAssociatedCanvas();
729 EXPECT_EQ(canvas, canvasElement());
730 }
731
722 } // namespace blink 732 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698