| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 | |
| 7 #include "core/html/canvas/CanvasRenderingContext2D.h" | 6 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 8 | 7 |
| 9 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 10 #include "core/html/HTMLDocument.h" | 9 #include "core/html/HTMLDocument.h" |
| 11 #include "core/html/ImageData.h" | 10 #include "core/html/ImageData.h" |
| 12 #include "core/html/canvas/CanvasGradient.h" | 11 #include "core/html/canvas/CanvasGradient.h" |
| 13 #include "core/html/canvas/CanvasPattern.h" | 12 #include "core/html/canvas/CanvasPattern.h" |
| 14 #include "core/html/canvas/WebGLRenderingContext.h" | 13 #include "core/html/canvas/WebGLRenderingContext.h" |
| 15 #include "core/loader/EmptyClients.h" | 14 #include "core/loader/EmptyClients.h" |
| 16 #include "core/testing/DummyPageHolder.h" | 15 #include "core/testing/DummyPageHolder.h" |
| 17 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 16 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 18 #include <gmock/gmock.h> | 17 #include <gmock/gmock.h> |
| 19 #include <gtest/gtest.h> | 18 #include <gtest/gtest.h> |
| 20 | 19 |
| 21 using namespace blink; | |
| 22 using ::testing::Mock; | 20 using ::testing::Mock; |
| 23 | 21 |
| 24 namespace { | 22 namespace blink { |
| 25 | 23 |
| 26 class CanvasRenderingContext2DAPITest : public ::testing::Test { | 24 class CanvasRenderingContext2DAPITest : public ::testing::Test { |
| 27 protected: | 25 protected: |
| 28 CanvasRenderingContext2DAPITest(); | 26 CanvasRenderingContext2DAPITest(); |
| 29 virtual void SetUp() override; | 27 void SetUp() override; |
| 30 | 28 |
| 31 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 29 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
| 32 HTMLDocument& document() const { return *m_document; } | 30 HTMLDocument& document() const { return *m_document; } |
| 33 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } | 31 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } |
| 34 CanvasRenderingContext2D* context2d() const; | 32 CanvasRenderingContext2D* context2d() const; |
| 35 | 33 |
| 36 void createContext(OpacityMode); | 34 void createContext(OpacityMode); |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 37 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 EXPECT_FALSE(exceptionState.hadException()); | 210 EXPECT_FALSE(exceptionState.hadException()); |
| 213 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState)
; | 211 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState)
; |
| 214 EXPECT_FALSE(exceptionState.hadException()); | 212 EXPECT_FALSE(exceptionState.hadException()); |
| 215 | 213 |
| 216 EXPECT_EQ((unsigned)800, imgdata1->data()->length()); | 214 EXPECT_EQ((unsigned)800, imgdata1->data()->length()); |
| 217 EXPECT_EQ((unsigned)800, imgdata2->data()->length()); | 215 EXPECT_EQ((unsigned)800, imgdata2->data()->length()); |
| 218 EXPECT_EQ((unsigned)800, imgdata3->data()->length()); | 216 EXPECT_EQ((unsigned)800, imgdata3->data()->length()); |
| 219 EXPECT_EQ((unsigned)800, imgdata4->data()->length()); | 217 EXPECT_EQ((unsigned)800, imgdata4->data()->length()); |
| 220 } | 218 } |
| 221 | 219 |
| 222 } // unnamed namespace | 220 } // namespace blink |
| OLD | NEW |