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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngineTest.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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"
(...skipping 16 matching lines...) Expand all
27 OwnPtr<DummyPageHolder> m_dummyPageHolder; 27 OwnPtr<DummyPageHolder> m_dummyPageHolder;
28 }; 28 };
29 29
30 void StyleEngineTest::SetUp() 30 void StyleEngineTest::SetUp()
31 { 31 {
32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
33 } 33 }
34 34
35 TEST_F(StyleEngineTest, DocumentDirtyAfterInject) 35 TEST_F(StyleEngineTest, DocumentDirtyAfterInject)
36 { 36 {
37 RefPtrWillBeRawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::cre ate(CSSParserContext(document(), nullptr)); 37 RawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParse rContext(document(), nullptr));
38 parsedSheet->parseString("div {}"); 38 parsedSheet->parseString("div {}");
39 styleEngine().injectAuthorSheet(parsedSheet); 39 styleEngine().injectAuthorSheet(parsedSheet);
40 document().view()->updateAllLifecyclePhases(); 40 document().view()->updateAllLifecyclePhases();
41 41
42 EXPECT_TRUE(isDocumentStyleSheetCollectionClean()); 42 EXPECT_TRUE(isDocumentStyleSheetCollectionClean());
43 } 43 }
44 44
45 TEST_F(StyleEngineTest, AnalyzedInject) 45 TEST_F(StyleEngineTest, AnalyzedInject)
46 { 46 {
47 document().body()->setInnerHTML("<style>div { color: red }</style><div id='t 1'>Green</div><div></div>", ASSERT_NO_EXCEPTION); 47 document().body()->setInnerHTML("<style>div { color: red }</style><div id='t 1'>Green</div><div></div>", ASSERT_NO_EXCEPTION);
48 document().view()->updateAllLifecyclePhases(); 48 document().view()->updateAllLifecyclePhases();
49 49
50 Element* t1 = document().getElementById("t1"); 50 Element* t1 = document().getElementById("t1");
51 ASSERT_TRUE(t1); 51 ASSERT_TRUE(t1);
52 ASSERT_TRUE(t1->computedStyle()); 52 ASSERT_TRUE(t1->computedStyle());
53 EXPECT_EQ(makeRGB(255, 0, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor)); 53 EXPECT_EQ(makeRGB(255, 0, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor));
54 54
55 unsigned beforeCount = styleEngine().styleForElementCount(); 55 unsigned beforeCount = styleEngine().styleForElementCount();
56 56
57 RefPtrWillBeRawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::cre ate(CSSParserContext(document(), nullptr)); 57 RawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParse rContext(document(), nullptr));
58 parsedSheet->parseString("#t1 { color: green }"); 58 parsedSheet->parseString("#t1 { color: green }");
59 styleEngine().injectAuthorSheet(parsedSheet); 59 styleEngine().injectAuthorSheet(parsedSheet);
60 document().view()->updateAllLifecyclePhases(); 60 document().view()->updateAllLifecyclePhases();
61 61
62 unsigned afterCount = styleEngine().styleForElementCount(); 62 unsigned afterCount = styleEngine().styleForElementCount();
63 EXPECT_EQ(1u, afterCount - beforeCount); 63 EXPECT_EQ(1u, afterCount - beforeCount);
64 64
65 ASSERT_TRUE(t1->computedStyle()); 65 ASSERT_TRUE(t1->computedStyle());
66 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor)); 66 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS PropertyColor));
67 } 67 }
68 68
69 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | third_party/WebKit/Source/core/dom/StyleSheetCandidate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698