| 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/HTMLSelectElement.h" | 6 #include "core/html/HTMLSelectElement.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/forms/FormController.h" | 10 #include "core/html/forms/FormController.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 void HTMLSelectElementTest::SetUp() | 27 void HTMLSelectElementTest::SetUp() |
| 28 { | 28 { |
| 29 Page::PageClients pageClients; | 29 Page::PageClients pageClients; |
| 30 fillWithEmptyClients(pageClients); | 30 fillWithEmptyClients(pageClients); |
| 31 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; | 31 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients)
; |
| 32 | 32 |
| 33 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 33 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 34 m_document->setMimeType("text/html"); | 34 m_document->setMimeType("text/html"); |
| 35 m_document->setCharset("utf-8"); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 TEST_F(HTMLSelectElementTest, SaveRestoreSelectSingleFormControlState) | 37 TEST_F(HTMLSelectElementTest, SaveRestoreSelectSingleFormControlState) |
| 39 { | 38 { |
| 40 document().documentElement()->setInnerHTML(String("<!DOCTYPE HTML><select id
='sel'>" | 39 document().documentElement()->setInnerHTML(String("<!DOCTYPE HTML><select id
='sel'>" |
| 41 "<option value='111' id='0'>111</option>" | 40 "<option value='111' id='0'>111</option>" |
| 42 "<option value='222'>222</option>" | 41 "<option value='222'>222</option>" |
| 43 "<option value='111' selected id='2'>!666</option>" | 42 "<option value='111' selected id='2'>!666</option>" |
| 44 "<option value='999'>999</option></select>"), ASSERT_NO_EXCEPTION); | 43 "<option value='999'>999</option></select>"), ASSERT_NO_EXCEPTION); |
| 45 document().view()->updateLayoutAndStyleForPainting(); | 44 document().view()->updateLayoutAndStyleForPainting(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ASSERT_FALSE(opt3->selected()); | 95 ASSERT_FALSE(opt3->selected()); |
| 97 | 96 |
| 98 // Restore | 97 // Restore |
| 99 select->restoreFormControlState(selectState); | 98 select->restoreFormControlState(selectState); |
| 100 EXPECT_FALSE(opt0->selected()); | 99 EXPECT_FALSE(opt0->selected()); |
| 101 EXPECT_TRUE(opt2->selected()); | 100 EXPECT_TRUE(opt2->selected()); |
| 102 EXPECT_TRUE(opt3->selected()); | 101 EXPECT_TRUE(opt3->selected()); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |