OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h" | 27 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h" |
28 | 28 |
29 #include "FakeWebGraphicsContext3D.h" | 29 #include "FakeWebGraphicsContext3D.h" |
30 #include "SkDeferredCanvas.h" | 30 #include "SkDeferredCanvas.h" |
31 #include "core/platform/chromium/support/GraphicsContext3DPrivate.h" | |
32 #include "core/platform/graphics/ImageBuffer.h" | 31 #include "core/platform/graphics/ImageBuffer.h" |
33 #include <public/Platform.h> | 32 #include <public/Platform.h> |
34 #include <public/WebThread.h> | 33 #include <public/WebThread.h> |
35 | 34 |
36 #include <gmock/gmock.h> | 35 #include <gmock/gmock.h> |
37 #include <gtest/gtest.h> | 36 #include <gtest/gtest.h> |
38 #include <wtf/RefPtr.h> | 37 #include <wtf/RefPtr.h> |
39 | 38 |
40 using namespace WebCore; | 39 using namespace WebCore; |
41 using namespace WebKit; | 40 using namespace WebKit; |
(...skipping 16 matching lines...) Expand all Loading... |
58 public: | 57 public: |
59 MOCK_METHOD3(appendCopy, void(unsigned, unsigned, WebSize)); | 58 MOCK_METHOD3(appendCopy, void(unsigned, unsigned, WebSize)); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace | 61 } // namespace |
63 | 62 |
64 class Canvas2DLayerBridgeTest : public Test { | 63 class Canvas2DLayerBridgeTest : public Test { |
65 protected: | 64 protected: |
66 void fullLifecycleTest(Canvas2DLayerBridge::ThreadMode threadMode) | 65 void fullLifecycleTest(Canvas2DLayerBridge::ThreadMode threadMode) |
67 { | 66 { |
68 RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::create
GraphicsContextFromWebContext(adoptPtr(new MockCanvasContext)); | 67 RefPtr<GraphicsContext3D> mainContext = GraphicsContext3D::createGraphic
sContextFromWebContext(adoptPtr(new MockCanvasContext)); |
69 | 68 |
70 MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsC
ontext3DPrivate::extractWebGraphicsContext3D(mainContext.get())); | 69 MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(mainConte
xt->webContext()); |
71 | 70 |
72 MockWebTextureUpdater updater; | 71 MockWebTextureUpdater updater; |
73 | 72 |
74 SkDevice device(SkBitmap::kARGB_8888_Config, 300, 150); | 73 SkDevice device(SkBitmap::kARGB_8888_Config, 300, 150); |
75 SkDeferredCanvas canvas(&device); | 74 SkDeferredCanvas canvas(&device); |
76 | 75 |
77 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 76 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
78 | 77 |
79 OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainCon
text.release(), &canvas, Canvas2DLayerBridge::NonOpaque, threadMode); | 78 OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainCon
text.release(), &canvas, Canvas2DLayerBridge::NonOpaque, threadMode); |
80 | 79 |
(...skipping 18 matching lines...) Expand all Loading... |
99 { | 98 { |
100 fullLifecycleTest(Canvas2DLayerBridge::SingleThread); | 99 fullLifecycleTest(Canvas2DLayerBridge::SingleThread); |
101 } | 100 } |
102 | 101 |
103 TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleThreaded) | 102 TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleThreaded) |
104 { | 103 { |
105 fullLifecycleTest(Canvas2DLayerBridge::Threaded); | 104 fullLifecycleTest(Canvas2DLayerBridge::Threaded); |
106 } | 105 } |
107 | 106 |
108 } // namespace | 107 } // namespace |
OLD | NEW |