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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngineTest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/dom/StyleEngine.h" 5 #include "core/dom/StyleEngine.h"
6 6
7 #include "core/css/StyleSheetContents.h" 7 #include "core/css/StyleSheetContents.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/NodeComputedStyle.h" 9 #include "core/dom/NodeComputedStyle.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/html/HTMLElement.h" 11 #include "core/html/HTMLElement.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include <memory>
15 14
16 namespace blink { 15 namespace blink {
17 16
18 class StyleEngineTest : public ::testing::Test { 17 class StyleEngineTest : public ::testing::Test {
19 protected: 18 protected:
20 void SetUp() override; 19 void SetUp() override;
21 20
22 Document& document() { return m_dummyPageHolder->document(); } 21 Document& document() { return m_dummyPageHolder->document(); }
23 StyleEngine& styleEngine() { return document().styleEngine(); } 22 StyleEngine& styleEngine() { return document().styleEngine(); }
24 23
25 bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpd ateDocumentStyleSheetCollection(AnalyzedStyleUpdate); } 24 bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpd ateDocumentStyleSheetCollection(AnalyzedStyleUpdate); }
26 25
27 private: 26 private:
28 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 27 OwnPtr<DummyPageHolder> m_dummyPageHolder;
29 }; 28 };
30 29
31 void StyleEngineTest::SetUp() 30 void StyleEngineTest::SetUp()
32 { 31 {
33 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
34 } 33 }
35 34
36 TEST_F(StyleEngineTest, DocumentDirtyAfterInject) 35 TEST_F(StyleEngineTest, DocumentDirtyAfterInject)
37 { 36 {
38 StyleSheetContents* parsedSheet = StyleSheetContents::create(CSSParserContex t(document(), nullptr)); 37 StyleSheetContents* parsedSheet = StyleSheetContents::create(CSSParserContex t(document(), nullptr));
(...skipping 22 matching lines...) Expand all
61 document().view()->updateAllLifecyclePhases(); 60 document().view()->updateAllLifecyclePhases();
62 61
63 unsigned afterCount = styleEngine().styleForElementCount(); 62 unsigned afterCount = styleEngine().styleForElementCount();
64 EXPECT_EQ(1u, afterCount - beforeCount); 63 EXPECT_EQ(1u, afterCount - beforeCount);
65 64
66 ASSERT_TRUE(t1->computedStyle()); 65 ASSERT_TRUE(t1->computedStyle());
67 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor)); 66 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor));
68 } 67 }
69 68
70 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698