OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "modules/document_metadata/CopylessPasteExtractor.h" | 5 #include "modules/document_metadata/CopylessPasteExtractor.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 "}\n" | 26 "}\n" |
27 "\n") {} | 27 "\n") {} |
28 | 28 |
29 protected: | 29 protected: |
30 void SetUp() override; | 30 void SetUp() override; |
31 | 31 |
32 void TearDown() override { ThreadState::current()->collectAllGarbage(); } | 32 void TearDown() override { ThreadState::current()->collectAllGarbage(); } |
33 | 33 |
34 Document& document() const { return m_dummyPageHolder->document(); } | 34 Document& document() const { return m_dummyPageHolder->document(); } |
35 | 35 |
36 String extract() { return CopylessPasteExtractor::extract(document()); } | 36 String extract() { return CopylessPasteExtractor::metadata(document()); } |
37 | 37 |
38 void setHtmlInnerHTML(const String&); | 38 void setHtmlInnerHTML(const String&); |
39 | 39 |
40 String m_content; | 40 String m_content; |
41 | 41 |
42 private: | 42 private: |
43 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 43 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
44 }; | 44 }; |
45 | 45 |
46 void CopylessPasteExtractorTest::SetUp() { | 46 void CopylessPasteExtractorTest::SetUp() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 "</body>"); | 100 "</body>"); |
101 | 101 |
102 String extracted = extract(); | 102 String extracted = extract(); |
103 String expected = "[" + m_content + "," + m_content + "," + m_content + "]"; | 103 String expected = "[" + m_content + "," + m_content + "," + m_content + "]"; |
104 EXPECT_EQ(expected, extracted); | 104 EXPECT_EQ(expected, extracted); |
105 } | 105 } |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |