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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulatorTest.cpp

Issue 2546373002: Properly simulate self-closing tags when in "foreign content" mode (Closed)
Patch Set: Add CORE_EXPORT Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/html/parser/HTMLTreeBuilderSimulator.h"
6
7 #include "core/html/parser/CompactHTMLToken.h"
8 #include "core/html/parser/HTMLToken.h"
9 #include "core/html/parser/HTMLTokenizer.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace blink {
13
14 TEST(HTMLTreeBuilderSimulatorTest, SelfClosingSVGFollowedByScript) {
15 HTMLParserOptions options;
16 HTMLTreeBuilderSimulator simulator(options);
17 std::unique_ptr<HTMLTokenizer> tokenizer = HTMLTokenizer::create(options);
18 SegmentedString input("<svg/><script></script>");
19 HTMLToken token;
20 EXPECT_TRUE(tokenizer->nextToken(input, token));
21 EXPECT_EQ(HTMLTreeBuilderSimulator::OtherToken,
22 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
23 tokenizer.get()));
24
25 token.clear();
26 EXPECT_TRUE(tokenizer->nextToken(input, token));
27 EXPECT_EQ(HTMLTreeBuilderSimulator::ScriptStart,
28 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
29 tokenizer.get()));
30
31 EXPECT_EQ(HTMLTokenizer::ScriptDataState, tokenizer->getState());
32
33 token.clear();
34 EXPECT_TRUE(tokenizer->nextToken(input, token));
35 EXPECT_EQ(HTMLTreeBuilderSimulator::ScriptEnd,
36 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
37 tokenizer.get()));
38 }
39
40 TEST(HTMLTreeBuilderSimulatorTest, SelfClosingMathFollowedByScript) {
41 HTMLParserOptions options;
42 HTMLTreeBuilderSimulator simulator(options);
43 std::unique_ptr<HTMLTokenizer> tokenizer = HTMLTokenizer::create(options);
44 SegmentedString input("<math/><script></script>");
45 HTMLToken token;
46 EXPECT_TRUE(tokenizer->nextToken(input, token));
47 EXPECT_EQ(HTMLTreeBuilderSimulator::OtherToken,
48 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
49 tokenizer.get()));
50
51 token.clear();
52 EXPECT_TRUE(tokenizer->nextToken(input, token));
53 EXPECT_EQ(HTMLTreeBuilderSimulator::ScriptStart,
54 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
55 tokenizer.get()));
56
57 EXPECT_EQ(HTMLTokenizer::ScriptDataState, tokenizer->getState());
58
59 token.clear();
60 EXPECT_TRUE(tokenizer->nextToken(input, token));
61 EXPECT_EQ(HTMLTreeBuilderSimulator::ScriptEnd,
62 simulator.simulate(CompactHTMLToken(&token, TextPosition()),
63 tokenizer.get()));
64 }
65
66 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698