OLD | NEW |
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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 RefPtrWillBeRawPtr<Document> document = Document::create(); | 52 RefPtrWillBeRawPtr<Document> document = Document::create(); |
53 RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document
); | 53 RefPtrWillBeRawPtr<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 RefPtrWillBeRawPtr<HTMLInputElement> input = HTMLInputElement::create(*docum
ent, 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 // crbug.com/589838 |
| 63 TEST(HTMLInputElementTest, ImageTypeCrash) |
| 64 { |
| 65 RefPtrWillBeRawPtr<Document> document = Document::create(); |
| 66 RefPtrWillBeRawPtr<HTMLInputElement> input = HTMLInputElement::create(*docum
ent, nullptr, false); |
| 67 input->setAttribute(HTMLNames::typeAttr, "image"); |
| 68 input->ensureFallbackContent(); |
| 69 // Make sure ensurePrimaryContent() recreates UA shadow tree, and updating |
| 70 // |value| doesn't crash. |
| 71 input->ensurePrimaryContent(); |
| 72 input->setAttribute(HTMLNames::valueAttr, "aaa"); |
| 73 } |
| 74 |
62 } // namespace blink | 75 } // namespace blink |
OLD | NEW |