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/HTMLFormElement.h" | 9 #include "core/html/HTMLFormElement.h" |
10 #include "core/html/HTMLHtmlElement.h" | 10 #include "core/html/HTMLHtmlElement.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 document->body()->appendChild(form.get()); | 63 document->body()->appendChild(form.get()); |
64 RefPtrWillBeRawPtr<HTMLInputElement> inputWithForm = HTMLInputElement::creat
e(*document, nullptr, false); | 64 RefPtrWillBeRawPtr<HTMLInputElement> inputWithForm = HTMLInputElement::creat
e(*document, nullptr, false); |
65 inputWithForm->setBooleanAttribute(HTMLNames::requiredAttr, true); | 65 inputWithForm->setBooleanAttribute(HTMLNames::requiredAttr, true); |
66 form->appendChild(inputWithForm.get()); | 66 form->appendChild(inputWithForm.get()); |
67 EXPECT_EQ("<<ValidationValueMissing>>", inputWithForm->defaultToolTip()); | 67 EXPECT_EQ("<<ValidationValueMissing>>", inputWithForm->defaultToolTip()); |
68 | 68 |
69 form->setBooleanAttribute(HTMLNames::novalidateAttr, true); | 69 form->setBooleanAttribute(HTMLNames::novalidateAttr, true); |
70 EXPECT_EQ(String(), inputWithForm->defaultToolTip()); | 70 EXPECT_EQ(String(), inputWithForm->defaultToolTip()); |
71 } | 71 } |
72 | 72 |
| 73 // crbug.com/589838 |
| 74 TEST(HTMLInputElementTest, ImageTypeCrash) |
| 75 { |
| 76 RefPtrWillBeRawPtr<Document> document = Document::create(); |
| 77 RefPtrWillBeRawPtr<HTMLInputElement> input = HTMLInputElement::create(*docum
ent, nullptr, false); |
| 78 input->setAttribute(HTMLNames::typeAttr, "image"); |
| 79 input->ensureFallbackContent(); |
| 80 // Make sure ensurePrimaryContent() recreates UA shadow tree, and updating |
| 81 // |value| doesn't crash. |
| 82 input->ensurePrimaryContent(); |
| 83 input->setAttribute(HTMLNames::valueAttr, "aaa"); |
| 84 } |
| 85 |
73 } // namespace blink | 86 } // namespace blink |
OLD | NEW |