| 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 "modules/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/HTMLDocument.h" | 10 #include "core/html/HTMLDocument.h" |
| 11 #include "core/html/ImageData.h" | 11 #include "core/html/ImageData.h" |
| 12 #include "core/loader/EmptyClients.h" | 12 #include "core/loader/EmptyClients.h" |
| 13 #include "core/testing/DummyPageHolder.h" | 13 #include "core/testing/DummyPageHolder.h" |
| 14 #include "modules/accessibility/AXObject.h" | 14 #include "modules/accessibility/AXObject.h" |
| 15 #include "modules/accessibility/AXObjectCacheImpl.h" | 15 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 16 #include "modules/canvas2d/CanvasGradient.h" | 16 #include "modules/canvas2d/CanvasGradient.h" |
| 17 #include "modules/canvas2d/CanvasPattern.h" | 17 #include "modules/canvas2d/CanvasPattern.h" |
| 18 #include "modules/canvas2d/HitRegionOptions.h" | 18 #include "modules/canvas2d/HitRegionOptions.h" |
| 19 #include "modules/webgl/WebGLRenderingContext.h" | 19 #include "modules/webgl/WebGLRenderingContext.h" |
| 20 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 20 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include <memory> |
| 23 | 24 |
| 24 using ::testing::Mock; | 25 using ::testing::Mock; |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 class CanvasRenderingContext2DAPITest : public ::testing::Test { | 29 class CanvasRenderingContext2DAPITest : public ::testing::Test { |
| 29 protected: | 30 protected: |
| 30 CanvasRenderingContext2DAPITest(); | 31 CanvasRenderingContext2DAPITest(); |
| 31 void SetUp() override; | 32 void SetUp() override; |
| 32 | 33 |
| 33 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 34 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
| 34 HTMLDocument& document() const { return *m_document; } | 35 HTMLDocument& document() const { return *m_document; } |
| 35 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } | 36 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } |
| 36 CanvasRenderingContext2D* context2d() const; | 37 CanvasRenderingContext2D* context2d() const; |
| 37 | 38 |
| 38 void createContext(OpacityMode); | 39 void createContext(OpacityMode); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 42 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
| 42 Persistent<HTMLDocument> m_document; | 43 Persistent<HTMLDocument> m_document; |
| 43 Persistent<HTMLCanvasElement> m_canvasElement; | 44 Persistent<HTMLCanvasElement> m_canvasElement; |
| 44 | 45 |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 CanvasRenderingContext2DAPITest::CanvasRenderingContext2DAPITest() | 48 CanvasRenderingContext2DAPITest::CanvasRenderingContext2DAPITest() |
| 48 { } | 49 { } |
| 49 | 50 |
| 50 CanvasRenderingContext2D* CanvasRenderingContext2DAPITest::context2d() const | 51 CanvasRenderingContext2D* CanvasRenderingContext2DAPITest::context2d() const |
| 51 { | 52 { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX
ObjectCache()); | 319 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX
ObjectCache()); |
| 319 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); | 320 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); |
| 320 | 321 |
| 321 EXPECT_EQ(25, axObject->elementRect().x().toInt()); | 322 EXPECT_EQ(25, axObject->elementRect().x().toInt()); |
| 322 EXPECT_EQ(25, axObject->elementRect().y().toInt()); | 323 EXPECT_EQ(25, axObject->elementRect().y().toInt()); |
| 323 EXPECT_EQ(40, axObject->elementRect().width().toInt()); | 324 EXPECT_EQ(40, axObject->elementRect().width().toInt()); |
| 324 EXPECT_EQ(40, axObject->elementRect().height().toInt()); | 325 EXPECT_EQ(40, axObject->elementRect().height().toInt()); |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace blink | 328 } // namespace blink |
| OLD | NEW |