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

Unified Diff: Source/web/tests/Canvas2DLayerBridgeTest.cpp

Issue 166093005: Clear m_lastImageId for software compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: test Created 6 years, 10 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
« no previous file with comments | « Source/platform/graphics/Canvas2DLayerBridge.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/Canvas2DLayerBridgeTest.cpp
diff --git a/Source/web/tests/Canvas2DLayerBridgeTest.cpp b/Source/web/tests/Canvas2DLayerBridgeTest.cpp
index 9d1b37cd55e68c0787697f6e0d1641e29e7eae1b..9f301080e8cab313d014281e9e773223d8f539a4 100644
--- a/Source/web/tests/Canvas2DLayerBridgeTest.cpp
+++ b/Source/web/tests/Canvas2DLayerBridgeTest.cpp
@@ -30,6 +30,7 @@
#include "SkSurface.h"
#include "platform/graphics/ImageBuffer.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebExternalBitmap.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
#include "public/platform/WebThread.h"
#include "third_party/skia/include/core/SkDevice.h"
@@ -90,6 +91,23 @@ private:
RefPtr<Canvas2DLayerBridge> m_layerBridge;
};
+class NullWebExternalBitmap : public WebExternalBitmap {
+public:
+ virtual WebSize size()
+ {
+ return WebSize();
+ }
+
+ virtual void setSize(WebSize)
+ {
+ }
+
+ virtual uint8* pixels()
+ {
+ return 0;
+ }
+};
+
} // namespace
class Canvas2DLayerBridgeTest : public Test {
@@ -116,6 +134,19 @@ protected:
::testing::Mock::VerifyAndClearExpectations(&mainMock);
}
+
+ void prepareMailboxWithBitmapTest()
+ {
+ MockCanvasContext mainMock;
+ OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(SkSurface::NewRasterPMColor(300, 150)));
+ OwnPtr<MockWebGraphicsContext3DProvider> mainMockProvider = adoptPtr(new MockWebGraphicsContext3DProvider(&mainMock));
+ Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(mainMockProvider.release(), canvas.release(), 0, NonOpaque)));
+ bridge->m_lastImageId = 1;
+
+ NullWebExternalBitmap bitmap;
+ bridge->prepareMailbox(0, &bitmap);
+ EXPECT_EQ(0u, bridge->m_lastImageId);
+ }
};
namespace {
@@ -125,4 +156,9 @@ TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleSingleThreaded)
fullLifecycleTest();
}
+TEST_F(Canvas2DLayerBridgeTest, prepareMailboxWithBitmapTest)
+{
+ prepareMailboxWithBitmapTest();
+}
+
} // namespace
« no previous file with comments | « Source/platform/graphics/Canvas2DLayerBridge.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698