| 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/HTMLSelectElement.h" | 5 #include "core/html/HTMLSelectElement.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/html/HTMLFormElement.h" | 9 #include "core/html/HTMLFormElement.h" |
| 10 #include "core/html/forms/FormController.h" | 10 #include "core/html/forms/FormController.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 TEST_F(HTMLSelectElementTest, PopupIsVisible) | 146 TEST_F(HTMLSelectElementTest, PopupIsVisible) |
| 147 { | 147 { |
| 148 document().documentElement()->setInnerHTML("<select><option>o1</option></sel
ect>", ASSERT_NO_EXCEPTION); | 148 document().documentElement()->setInnerHTML("<select><option>o1</option></sel
ect>", ASSERT_NO_EXCEPTION); |
| 149 document().view()->updateAllLifecyclePhases(); | 149 document().view()->updateAllLifecyclePhases(); |
| 150 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil
d()); | 150 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil
d()); |
| 151 ASSERT_NE(select, nullptr); | 151 ASSERT_NE(select, nullptr); |
| 152 EXPECT_FALSE(select->popupIsVisible()); | 152 EXPECT_FALSE(select->popupIsVisible()); |
| 153 select->showPopup(); | 153 select->showPopup(); |
| 154 EXPECT_TRUE(select->popupIsVisible()); | 154 EXPECT_TRUE(select->popupIsVisible()); |
| 155 document().detachLayoutTree(); | 155 document().shutdown(); |
| 156 EXPECT_FALSE(select->popupIsVisible()); | 156 EXPECT_FALSE(select->popupIsVisible()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST_F(HTMLSelectElementTest, FirstSelectableOption) | 159 TEST_F(HTMLSelectElementTest, FirstSelectableOption) |
| 160 { | 160 { |
| 161 { | 161 { |
| 162 document().documentElement()->setInnerHTML("<select></select>", ASSERT_N
O_EXCEPTION); | 162 document().documentElement()->setInnerHTML("<select></select>", ASSERT_N
O_EXCEPTION); |
| 163 document().view()->updateAllLifecyclePhases(); | 163 document().view()->updateAllLifecyclePhases(); |
| 164 HTMLSelectElement* select = toHTMLSelectElement(document().body()->first
Child()); | 164 HTMLSelectElement* select = toHTMLSelectElement(document().body()->first
Child()); |
| 165 EXPECT_EQ(nullptr, select->firstSelectableOption()); | 165 EXPECT_EQ(nullptr, select->firstSelectableOption()); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 TEST_F(HTMLSelectElementTest, SetRecalcListItemsByOptgroupRemoval) | 375 TEST_F(HTMLSelectElementTest, SetRecalcListItemsByOptgroupRemoval) |
| 376 { | 376 { |
| 377 document().documentElement()->setInnerHTML("<select><optgroup><option>sub1</
option><option>sub2</option></optgroup></select>", ASSERT_NO_EXCEPTION); | 377 document().documentElement()->setInnerHTML("<select><optgroup><option>sub1</
option><option>sub2</option></optgroup></select>", ASSERT_NO_EXCEPTION); |
| 378 document().view()->updateAllLifecyclePhases(); | 378 document().view()->updateAllLifecyclePhases(); |
| 379 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil
d()); | 379 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil
d()); |
| 380 select->setInnerHTML("", ASSERT_NO_EXCEPTION); | 380 select->setInnerHTML("", ASSERT_NO_EXCEPTION); |
| 381 // PASS if setInnerHTML didn't have a check failure. | 381 // PASS if setInnerHTML didn't have a check failure. |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |