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

Side by Side Diff: Source/core/editing/StyledMarkupSerializerTest.cpp

Issue 1171323003: Fix unit test style in core/{dom,editing,html}/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: whitespace fix Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "core/editing/StyledMarkupSerializer.h" 6 #include "core/editing/StyledMarkupSerializer.h"
7 7
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
(...skipping 14 matching lines...) Expand all
25 #include "wtf/testing/WTFTestHelpers.h" 25 #include "wtf/testing/WTFTestHelpers.h"
26 #include <gtest/gtest.h> 26 #include <gtest/gtest.h>
27 #include <string> 27 #include <string>
28 28
29 namespace blink { 29 namespace blink {
30 30
31 // This is smoke test of |StyledMarkupSerializer|. Full testing will be done 31 // This is smoke test of |StyledMarkupSerializer|. Full testing will be done
32 // in layout tests. 32 // in layout tests.
33 class StyledMarkupSerializerTest : public ::testing::Test { 33 class StyledMarkupSerializerTest : public ::testing::Test {
34 protected: 34 protected:
35 virtual void SetUp() override; 35 void SetUp() override;
36 36
37 HTMLDocument& document() const { return *m_document; } 37 HTMLDocument& document() const { return *m_document; }
38 38
39 template <typename Tree> 39 template <typename Tree>
40 std::string serialize(); 40 std::string serialize();
41 41
42 void setBodyContent(const char*); 42 void setBodyContent(const char*);
43 PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char*); 43 PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char*);
44 44
45 private: 45 private:
(...skipping 10 matching lines...) Expand all
56 56
57 template <typename Tree> 57 template <typename Tree>
58 std::string StyledMarkupSerializerTest::serialize() 58 std::string StyledMarkupSerializerTest::serialize()
59 { 59 {
60 using PositionType = typename Tree::PositionType; 60 using PositionType = typename Tree::PositionType;
61 PositionType start = PositionType(m_document->body(), PositionType::Position IsBeforeChildren); 61 PositionType start = PositionType(m_document->body(), PositionType::Position IsBeforeChildren);
62 PositionType end = PositionType(m_document->body(), PositionType::PositionIs AfterChildren); 62 PositionType end = PositionType(m_document->body(), PositionType::PositionIs AfterChildren);
63 return CreateMarkupAlgorithm<Tree>::createMarkup(start, end).utf8().data(); 63 return CreateMarkupAlgorithm<Tree>::createMarkup(start, end).utf8().data();
64 } 64 }
65 65
66 PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSetInnerHT ML(TreeScope& scope, const char* hostElementID, const char* shadowRootContent) 66 static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSet InnerHTML(TreeScope& scope, const char* hostElementID, const char* shadowRootCon tent)
67 { 67 {
68 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicStrin g::fromUTF8(hostElementID))->createShadowRoot(ASSERT_NO_EXCEPTION); 68 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicStrin g::fromUTF8(hostElementID))->createShadowRoot(ASSERT_NO_EXCEPTION);
69 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE PTION); 69 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE PTION);
70 return shadowRoot.release(); 70 return shadowRoot.release();
71 } 71 }
72 72
73 void StyledMarkupSerializerTest::setBodyContent(const char* bodyContent) 73 void StyledMarkupSerializerTest::setBodyContent(const char* bodyContent)
74 { 74 {
75 document().body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXC EPTION); 75 document().body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXC EPTION);
76 } 76 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 173
174 TEST_F(StyledMarkupSerializerTest, StyleDisplayNone) 174 TEST_F(StyledMarkupSerializerTest, StyleDisplayNone)
175 { 175 {
176 const char* bodyContent = "<b>00<i style='display:none'>11</i>22</b>"; 176 const char* bodyContent = "<b>00<i style='display:none'>11</i>22</b>";
177 setBodyContent(bodyContent); 177 setBodyContent(bodyContent);
178 const char* expectedResult = "<b>0022</b>"; 178 const char* expectedResult = "<b>0022</b>";
179 EXPECT_EQ(expectedResult, serialize<EditingStrategy>()); 179 EXPECT_EQ(expectedResult, serialize<EditingStrategy>());
180 } 180 }
181 181
182 } // namespace 182 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/InputMethodControllerTest.cpp ('k') | Source/core/editing/SurroundingTextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698