| 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 | 6 |
| 7 #include "core/html/canvas/CanvasRenderingContext2D.h" | 7 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 8 | 8 |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/ImageBitmap.h" | 10 #include "core/frame/ImageBitmap.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 m_canvasElement->getContext(canvasType, attributes, result); | 111 m_canvasElement->getContext(canvasType, attributes, result); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void CanvasRenderingContext2DTest::SetUp() | 114 void CanvasRenderingContext2DTest::SetUp() |
| 115 { | 115 { |
| 116 Page::PageClients pageClients; | 116 Page::PageClients pageClients; |
| 117 fillWithEmptyClients(pageClients); | 117 fillWithEmptyClients(pageClients); |
| 118 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; | 118 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; |
| 119 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 119 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 120 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas><
/body>", ASSERT_NO_EXCEPTION); | 120 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas><
/body>", ASSERT_NO_EXCEPTION); |
| 121 m_document->view()->updateLayoutAndStyleIfNeededRecursive(); | 121 m_document->view()->updateLayoutAndStyleForPainting(); |
| 122 m_canvasElement = toHTMLCanvasElement(m_document->getElementById("c")); | 122 m_canvasElement = toHTMLCanvasElement(m_document->getElementById("c")); |
| 123 | 123 |
| 124 m_fullImageData = ImageData::create(IntSize(10, 10)); | 124 m_fullImageData = ImageData::create(IntSize(10, 10)); |
| 125 m_partialImageData = ImageData::create(IntSize(2, 2)); | 125 m_partialImageData = ImageData::create(IntSize(2, 2)); |
| 126 | 126 |
| 127 NonThrowableExceptionState exceptionState; | 127 NonThrowableExceptionState exceptionState; |
| 128 RefPtrWillBeRawPtr<CanvasGradient> opaqueGradient = CanvasGradient::create(F
loatPoint(0, 0), FloatPoint(10, 0)); | 128 RefPtrWillBeRawPtr<CanvasGradient> opaqueGradient = CanvasGradient::create(F
loatPoint(0, 0), FloatPoint(10, 0)); |
| 129 opaqueGradient->addColorStop(0, String("green"), exceptionState); | 129 opaqueGradient->addColorStop(0, String("green"), exceptionState); |
| 130 EXPECT_FALSE(exceptionState.hadException()); | 130 EXPECT_FALSE(exceptionState.hadException()); |
| 131 opaqueGradient->addColorStop(1, String("blue"), exceptionState); | 131 opaqueGradient->addColorStop(1, String("blue"), exceptionState); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // The canvasChanged notification must be immediate, and not deferred until
paint time | 598 // The canvasChanged notification must be immediate, and not deferred until
paint time |
| 599 // because offscreen canvases, which are not painted, also need to emit noti
fications. | 599 // because offscreen canvases, which are not painted, also need to emit noti
fications. |
| 600 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1)
)).Times(1); | 600 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1)
)).Times(1); |
| 601 context2d()->fillRect(0, 0, 1, 1); | 601 context2d()->fillRect(0, 0, 1, 1); |
| 602 Mock::VerifyAndClearExpectations(observer.get()); | 602 Mock::VerifyAndClearExpectations(observer.get()); |
| 603 | 603 |
| 604 canvasElement().removeObserver(observer.get()); | 604 canvasElement().removeObserver(observer.get()); |
| 605 } | 605 } |
| 606 | 606 |
| 607 } // unnamed namespace | 607 } // unnamed namespace |
| OLD | NEW |