| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/html/HTMLFormControlElement.h" | 6 #include "core/html/HTMLFormControlElement.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/html/HTMLDocument.h" | 9 #include "core/html/HTMLDocument.h" |
| 10 #include "core/html/HTMLInputElement.h" | 10 #include "core/html/HTMLInputElement.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 void HTMLFormControlElementTest::SetUp() | 30 void HTMLFormControlElementTest::SetUp() |
| 31 { | 31 { |
| 32 Page::PageClients pageClients; | 32 Page::PageClients pageClients; |
| 33 fillWithEmptyClients(pageClients); | 33 fillWithEmptyClients(pageClients); |
| 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; | 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; |
| 35 | 35 |
| 36 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 36 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 37 m_document->setMimeType("text/html"); | 37 m_document->setMimeType("text/html"); |
| 38 m_document->setCharset("utf-8"); | |
| 39 } | 38 } |
| 40 | 39 |
| 41 TEST_F(HTMLFormControlElementTest, customValidationMessageTextDirection) | 40 TEST_F(HTMLFormControlElementTest, customValidationMessageTextDirection) |
| 42 { | 41 { |
| 43 document().documentElement()->setInnerHTML("<body><input required id=input><
/body>", ASSERT_NO_EXCEPTION); | 42 document().documentElement()->setInnerHTML("<body><input required id=input><
/body>", ASSERT_NO_EXCEPTION); |
| 44 document().view()->updateLayoutAndStyleForPainting(); | 43 document().view()->updateLayoutAndStyleForPainting(); |
| 45 | 44 |
| 46 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); | 45 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); |
| 47 input->setCustomValidity(String::fromUTF8("\xD8\xB9\xD8\xB1\xD8\xA8\xD9\x89"
)); | 46 input->setCustomValidity(String::fromUTF8("\xD8\xB9\xD8\xB1\xD8\xA8\xD9\x89"
)); |
| 48 input->setAttribute(HTMLNames::titleAttr, AtomicString::fromUTF8("\xD8\xB9\x
D8\xB1\xD8\xA8\xD9\x89")); | 47 input->setAttribute(HTMLNames::titleAttr, AtomicString::fromUTF8("\xD8\xB9\x
D8\xB1\xD8\xA8\xD9\x89")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 EXPECT_EQ(RTL, subMessageDir); | 61 EXPECT_EQ(RTL, subMessageDir); |
| 63 | 62 |
| 64 input->setCustomValidity(String::fromUTF8("Main message.")); | 63 input->setCustomValidity(String::fromUTF8("Main message.")); |
| 65 message = input->validationMessage().stripWhiteSpace(); | 64 message = input->validationMessage().stripWhiteSpace(); |
| 66 input->findCustomValidationMessageTextDirection(message, messageDir, subMess
age, subMessageDir); | 65 input->findCustomValidationMessageTextDirection(message, messageDir, subMess
age, subMessageDir); |
| 67 EXPECT_EQ(LTR, messageDir); | 66 EXPECT_EQ(LTR, messageDir); |
| 68 EXPECT_EQ(RTL, subMessageDir); | 67 EXPECT_EQ(RTL, subMessageDir); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } | 70 } |
| OLD | NEW |