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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElementTest.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, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/HTMLInputElement.h" 5 #include "core/html/HTMLInputElement.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/html/HTMLBodyElement.h" 8 #include "core/html/HTMLBodyElement.h"
9 #include "core/html/HTMLHtmlElement.h" 9 #include "core/html/HTMLHtmlElement.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 TEST(HTMLInputElementTest, create) 15 TEST(HTMLInputElementTest, create)
16 { 16 {
17 const RefPtrWillBeRawPtr<Document> document = Document::create(); 17 const RawPtr<Document> document = Document::create();
18 RefPtrWillBeRawPtr<HTMLInputElement> input = HTMLInputElement::create(*docum ent, nullptr, /* createdByParser */ false); 18 RawPtr<HTMLInputElement> input = HTMLInputElement::create(*document, nullptr , /* createdByParser */ false);
19 EXPECT_NE(nullptr, input->userAgentShadowRoot()); 19 EXPECT_NE(nullptr, input->userAgentShadowRoot());
20 20
21 input = HTMLInputElement::create(*document, nullptr, /* createdByParser */ t rue); 21 input = HTMLInputElement::create(*document, nullptr, /* createdByParser */ t rue);
22 EXPECT_EQ(nullptr, input->userAgentShadowRoot()); 22 EXPECT_EQ(nullptr, input->userAgentShadowRoot());
23 input->parserSetAttributes(Vector<Attribute>()); 23 input->parserSetAttributes(Vector<Attribute>());
24 EXPECT_NE(nullptr, input->userAgentShadowRoot()); 24 EXPECT_NE(nullptr, input->userAgentShadowRoot());
25 } 25 }
26 26
27 TEST(HTMLInputElementTest, NoAssertWhenMovedInNewDocument) 27 TEST(HTMLInputElementTest, NoAssertWhenMovedInNewDocument)
28 { 28 {
29 const RefPtrWillBeRawPtr<Document> documentWithoutFrame = Document::create() ; 29 const RawPtr<Document> documentWithoutFrame = Document::create();
30 EXPECT_EQ(nullptr, documentWithoutFrame->frameHost()); 30 EXPECT_EQ(nullptr, documentWithoutFrame->frameHost());
31 RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document WithoutFrame); 31 RawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*documentWithoutFrame );
32 html->appendChild(HTMLBodyElement::create(*documentWithoutFrame)); 32 html->appendChild(HTMLBodyElement::create(*documentWithoutFrame));
33 33
34 // Create an input element with type "range" inside a document without frame . 34 // Create an input element with type "range" inside a document without frame .
35 toHTMLBodyElement(html->firstChild())->setInnerHTML("<input type='range' />" , ASSERT_NO_EXCEPTION); 35 toHTMLBodyElement(html->firstChild())->setInnerHTML("<input type='range' />" , ASSERT_NO_EXCEPTION);
36 documentWithoutFrame->appendChild(html.release()); 36 documentWithoutFrame->appendChild(html.release());
37 37
38 OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); 38 OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create();
39 auto& document = pageHolder->document(); 39 auto& document = pageHolder->document();
40 EXPECT_NE(nullptr, document.frameHost()); 40 EXPECT_NE(nullptr, document.frameHost());
41 41
42 // Put the input element inside a document with frame. 42 // Put the input element inside a document with frame.
43 document.body()->appendChild(documentWithoutFrame->body()->firstChild()); 43 document.body()->appendChild(documentWithoutFrame->body()->firstChild());
44 44
45 // Remove the input element and all refs to it so it gets deleted before the document. 45 // Remove the input element and all refs to it so it gets deleted before the document.
46 // The assert in |EventHandlerRegistry::updateEventHandlerTargets()| should not be triggered. 46 // The assert in |EventHandlerRegistry::updateEventHandlerTargets()| should not be triggered.
47 document.body()->removeChild(document.body()->firstChild()); 47 document.body()->removeChild(document.body()->firstChild());
48 } 48 }
49 49
50 TEST(HTMLInputElementTest, DefaultToolTip) 50 TEST(HTMLInputElementTest, DefaultToolTip)
51 { 51 {
52 RefPtrWillBeRawPtr<Document> document = Document::create(); 52 RawPtr<Document> document = Document::create();
53 RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document ); 53 RawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document);
54 html->appendChild(HTMLBodyElement::create(*document)); 54 html->appendChild(HTMLBodyElement::create(*document));
55 RefPtrWillBeRawPtr<HTMLInputElement> input = HTMLInputElement::create(*docum ent, nullptr, false); 55 RawPtr<HTMLInputElement> input = HTMLInputElement::create(*document, nullptr , false);
56 input->setBooleanAttribute(HTMLNames::requiredAttr, true); 56 input->setBooleanAttribute(HTMLNames::requiredAttr, true);
57 toHTMLBodyElement(html->firstChild())->appendChild(input.get()); 57 toHTMLBodyElement(html->firstChild())->appendChild(input.get());
58 document->appendChild(html.release()); 58 document->appendChild(html.release());
59 EXPECT_EQ("<<ValidationValueMissing>>", input->defaultToolTip()); 59 EXPECT_EQ("<<ValidationValueMissing>>", input->defaultToolTip());
60 } 60 }
61 61
62 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698