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> | |
24 | 23 |
25 using ::testing::Mock; | 24 using ::testing::Mock; |
26 | 25 |
27 namespace blink { | 26 namespace blink { |
28 | 27 |
29 class CanvasRenderingContext2DAPITest : public ::testing::Test { | 28 class CanvasRenderingContext2DAPITest : public ::testing::Test { |
30 protected: | 29 protected: |
31 CanvasRenderingContext2DAPITest(); | 30 CanvasRenderingContext2DAPITest(); |
32 void SetUp() override; | 31 void SetUp() override; |
33 | 32 |
34 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 33 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
35 HTMLDocument& document() const { return *m_document; } | 34 HTMLDocument& document() const { return *m_document; } |
36 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } | 35 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } |
37 CanvasRenderingContext2D* context2d() const; | 36 CanvasRenderingContext2D* context2d() const; |
38 | 37 |
39 void createContext(OpacityMode); | 38 void createContext(OpacityMode); |
40 | 39 |
41 private: | 40 private: |
42 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 41 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
43 Persistent<HTMLDocument> m_document; | 42 Persistent<HTMLDocument> m_document; |
44 Persistent<HTMLCanvasElement> m_canvasElement; | 43 Persistent<HTMLCanvasElement> m_canvasElement; |
45 | 44 |
46 }; | 45 }; |
47 | 46 |
48 CanvasRenderingContext2DAPITest::CanvasRenderingContext2DAPITest() | 47 CanvasRenderingContext2DAPITest::CanvasRenderingContext2DAPITest() |
49 { } | 48 { } |
50 | 49 |
51 CanvasRenderingContext2D* CanvasRenderingContext2DAPITest::context2d() const | 50 CanvasRenderingContext2D* CanvasRenderingContext2DAPITest::context2d() const |
52 { | 51 { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX
ObjectCache()); | 318 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX
ObjectCache()); |
320 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); | 319 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); |
321 | 320 |
322 EXPECT_EQ(25, axObject->elementRect().x().toInt()); | 321 EXPECT_EQ(25, axObject->elementRect().x().toInt()); |
323 EXPECT_EQ(25, axObject->elementRect().y().toInt()); | 322 EXPECT_EQ(25, axObject->elementRect().y().toInt()); |
324 EXPECT_EQ(40, axObject->elementRect().width().toInt()); | 323 EXPECT_EQ(40, axObject->elementRect().width().toInt()); |
325 EXPECT_EQ(40, axObject->elementRect().height().toInt()); | 324 EXPECT_EQ(40, axObject->elementRect().height().toInt()); |
326 } | 325 } |
327 | 326 |
328 } // namespace blink | 327 } // namespace blink |
OLD | NEW |