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

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

Issue 2318283002: DCHECK that the document url is valid in HTMLPreloadScanner (Closed)
Patch Set: fix unit test Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/html/parser/HTMLDocumentParser.h" 5 #include "core/html/parser/HTMLDocumentParser.h"
6 6
7 #include "core/html/HTMLDocument.h" 7 #include "core/html/HTMLDocument.h"
8 #include "core/html/parser/TextResourceDecoder.h" 8 #include "core/html/parser/TextResourceDecoder.h"
9 #include "core/loader/PrerendererClient.h" 9 #include "core/loader/PrerendererClient.h"
10 #include "core/loader/TextResourceDecoderBuilder.h" 10 #include "core/loader/TextResourceDecoderBuilder.h"
(...skipping 20 matching lines...) Expand all
31 bool isPrefetchOnly() override { return m_isPrefetchOnly; } 31 bool isPrefetchOnly() override { return m_isPrefetchOnly; }
32 32
33 bool m_isPrefetchOnly; 33 bool m_isPrefetchOnly;
34 }; 34 };
35 35
36 class HTMLDocumentParserTest : public testing::Test { 36 class HTMLDocumentParserTest : public testing::Test {
37 protected: 37 protected:
38 HTMLDocumentParserTest() 38 HTMLDocumentParserTest()
39 : m_dummyPageHolder(DummyPageHolder::create()) 39 : m_dummyPageHolder(DummyPageHolder::create())
40 { 40 {
41 m_dummyPageHolder->document().setURL(KURL(KURL(), "https://example.test" ));
41 } 42 }
42 43
43 HTMLDocumentParser* createParser(HTMLDocument& document) 44 HTMLDocumentParser* createParser(HTMLDocument& document)
44 { 45 {
45 HTMLDocumentParser* parser = 46 HTMLDocumentParser* parser =
46 HTMLDocumentParser::create(document, ForceSynchronousParsing); 47 HTMLDocumentParser::create(document, ForceSynchronousParsing);
47 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom); 48 TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom);
48 std::unique_ptr<TextResourceDecoder> decoder( 49 std::unique_ptr<TextResourceDecoder> decoder(
49 decoderBuilder.buildFor(&document)); 50 decoderBuilder.buildFor(&document));
50 parser->setDecoder(std::move(decoder)); 51 parser->setDecoder(std::move(decoder));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const char bytes[] = "<ht"; 84 const char bytes[] = "<ht";
84 parser->appendBytes(bytes, sizeof(bytes)); 85 parser->appendBytes(bytes, sizeof(bytes));
85 // The bytes are forwarded to the tokenizer. 86 // The bytes are forwarded to the tokenizer.
86 HTMLScriptRunnerHost* scriptRunnerHost = 87 HTMLScriptRunnerHost* scriptRunnerHost =
87 parser->asHTMLScriptRunnerHostForTesting(); 88 parser->asHTMLScriptRunnerHostForTesting();
88 EXPECT_FALSE(scriptRunnerHost->hasPreloadScanner()); 89 EXPECT_FALSE(scriptRunnerHost->hasPreloadScanner());
89 EXPECT_EQ(HTMLTokenizer::TagNameState, parser->tokenizer()->getState()); 90 EXPECT_EQ(HTMLTokenizer::TagNameState, parser->tokenizer()->getState());
90 } 91 }
91 92
92 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698