Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "core/loader/EmptyClients.h" 11 #include "core/loader/EmptyClients.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 13 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include <memory>
17 16
18 using ::testing::Mock; 17 using ::testing::Mock;
19 18
20 namespace blink { 19 namespace blink {
21 20
22 class CanvasFontCacheTest : public ::testing::Test { 21 class CanvasFontCacheTest : public ::testing::Test {
23 protected: 22 protected:
24 CanvasFontCacheTest(); 23 CanvasFontCacheTest();
25 void SetUp() override; 24 void SetUp() override;
26 25
27 DummyPageHolder& page() const { return *m_dummyPageHolder; } 26 DummyPageHolder& page() const { return *m_dummyPageHolder; }
28 HTMLDocument& document() const { return *m_document; } 27 HTMLDocument& document() const { return *m_document; }
29 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } 28 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; }
30 CanvasRenderingContext* context2d() const; 29 CanvasRenderingContext* context2d() const;
31 CanvasFontCache* cache() { return m_document->canvasFontCache(); } 30 CanvasFontCache* cache() { return m_document->canvasFontCache(); }
32 31
33 private: 32 private:
34 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 33 OwnPtr<DummyPageHolder> m_dummyPageHolder;
35 Persistent<HTMLDocument> m_document; 34 Persistent<HTMLDocument> m_document;
36 Persistent<HTMLCanvasElement> m_canvasElement; 35 Persistent<HTMLCanvasElement> m_canvasElement;
37 }; 36 };
38 37
39 CanvasFontCacheTest::CanvasFontCacheTest() 38 CanvasFontCacheTest::CanvasFontCacheTest()
40 { } 39 { }
41 40
42 CanvasRenderingContext* CanvasFontCacheTest::context2d() const 41 CanvasRenderingContext* CanvasFontCacheTest::context2d() const
43 { 42 {
44 // If the following check fails, perhaps you forgot to call createContext 43 // If the following check fails, perhaps you forgot to call createContext
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_FALSE(cache()->isInCache("15px sans-serif")); 95 EXPECT_FALSE(cache()->isInCache("15px sans-serif"));
97 96
98 page().page().setVisibilityState(PageVisibilityStateVisible, false); 97 page().page().setVisibilityState(PageVisibilityStateVisible, false);
99 context2d()->setFont("15px sans-serif"); 98 context2d()->setFont("15px sans-serif");
100 context2d()->setFont("10px sans-serif"); 99 context2d()->setFont("10px sans-serif");
101 EXPECT_TRUE(cache()->isInCache("10px sans-serif")); 100 EXPECT_TRUE(cache()->isInCache("10px sans-serif"));
102 EXPECT_TRUE(cache()->isInCache("15px sans-serif")); 101 EXPECT_TRUE(cache()->isInCache("15px sans-serif"));
103 } 102 }
104 103
105 } // namespace blink 104 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698