| 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 "core/html/canvas/CanvasFontCache.h" | 5 #include "core/html/canvas/CanvasFontCache.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/html/HTMLDocument.h" | 8 #include "core/html/HTMLDocument.h" |
| 9 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 9 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| 10 #include "core/html/canvas/CanvasRenderingContext.h" | 10 #include "core/html/canvas/CanvasRenderingContext.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void SetUp() override; | 24 void SetUp() override; |
| 25 | 25 |
| 26 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 26 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
| 27 HTMLDocument& document() const { return *m_document; } | 27 HTMLDocument& document() const { return *m_document; } |
| 28 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } | 28 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } |
| 29 CanvasRenderingContext* context2d() const; | 29 CanvasRenderingContext* context2d() const; |
| 30 CanvasFontCache* cache() { return m_document->canvasFontCache(); } | 30 CanvasFontCache* cache() { return m_document->canvasFontCache(); } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 33 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
| 34 RefPtrWillBePersistent<HTMLDocument> m_document; | 34 Persistent<HTMLDocument> m_document; |
| 35 RefPtrWillBePersistent<HTMLCanvasElement> m_canvasElement; | 35 Persistent<HTMLCanvasElement> m_canvasElement; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 CanvasFontCacheTest::CanvasFontCacheTest() | 38 CanvasFontCacheTest::CanvasFontCacheTest() |
| 39 { } | 39 { } |
| 40 | 40 |
| 41 CanvasRenderingContext* CanvasFontCacheTest::context2d() const | 41 CanvasRenderingContext* CanvasFontCacheTest::context2d() const |
| 42 { | 42 { |
| 43 // If the following check fails, perhaps you forgot to call createContext | 43 // If the following check fails, perhaps you forgot to call createContext |
| 44 // in your test? | 44 // in your test? |
| 45 EXPECT_NE(nullptr, canvasElement().renderingContext()); | 45 EXPECT_NE(nullptr, canvasElement().renderingContext()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 EXPECT_FALSE(cache()->isInCache("15px sans-serif")); | 95 EXPECT_FALSE(cache()->isInCache("15px sans-serif")); |
| 96 | 96 |
| 97 page().page().setVisibilityState(PageVisibilityStateVisible, false); | 97 page().page().setVisibilityState(PageVisibilityStateVisible, false); |
| 98 context2d()->setFont("15px sans-serif"); | 98 context2d()->setFont("15px sans-serif"); |
| 99 context2d()->setFont("10px sans-serif"); | 99 context2d()->setFont("10px sans-serif"); |
| 100 EXPECT_TRUE(cache()->isInCache("10px sans-serif")); | 100 EXPECT_TRUE(cache()->isInCache("10px sans-serif")); |
| 101 EXPECT_TRUE(cache()->isInCache("15px sans-serif")); | 101 EXPECT_TRUE(cache()->isInCache("15px sans-serif")); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |