| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/HTMLEmbedElement.h" | 5 #include "core/html/HTMLEmbedElement.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/HTMLObjectElement.h" | 9 #include "core/html/HTMLObjectElement.h" |
| 10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 "<param name='allowScriptAccess' value='Always'>" | 51 "<param name='allowScriptAccess' value='Always'>" |
| 52 "<embed src='//site.com/flash-cookie.swf' allowscriptaccess='Always' " | 52 "<embed src='//site.com/flash-cookie.swf' allowscriptaccess='Always' " |
| 53 "width='1' height='1' id='fce'>" | 53 "width='1' height='1' id='fce'>" |
| 54 "</object></div>"); | 54 "</object></div>"); |
| 55 | 55 |
| 56 auto* objectElement = document().getElementById("fco"); | 56 auto* objectElement = document().getElementById("fco"); |
| 57 ASSERT_TRUE(objectElement); | 57 ASSERT_TRUE(objectElement); |
| 58 ASSERT_TRUE(isHTMLObjectElement(objectElement)); | 58 ASSERT_TRUE(isHTMLObjectElement(objectElement)); |
| 59 HTMLObjectElement* object = toHTMLObjectElement(objectElement); | 59 HTMLObjectElement* object = toHTMLObjectElement(objectElement); |
| 60 | 60 |
| 61 // At this moment updateWidget() function is not called, so | 61 // At this moment updatePlugin() function is not called, so |
| 62 // useFallbackContent() will return false. | 62 // useFallbackContent() will return false. |
| 63 // But the element will likely to use fallback content after updateWidget(). | 63 // But the element will likely to use fallback content after updatePlugin(). |
| 64 EXPECT_TRUE(object->hasFallbackContent()); | 64 EXPECT_TRUE(object->hasFallbackContent()); |
| 65 EXPECT_FALSE(object->useFallbackContent()); | 65 EXPECT_FALSE(object->useFallbackContent()); |
| 66 EXPECT_TRUE(object->willUseFallbackContentAtLayout()); | 66 EXPECT_TRUE(object->willUseFallbackContentAtLayout()); |
| 67 | 67 |
| 68 auto* embedElement = document().getElementById("fce"); | 68 auto* embedElement = document().getElementById("fce"); |
| 69 ASSERT_TRUE(embedElement); | 69 ASSERT_TRUE(embedElement); |
| 70 ASSERT_TRUE(isHTMLEmbedElement(embedElement)); | 70 ASSERT_TRUE(isHTMLEmbedElement(embedElement)); |
| 71 HTMLEmbedElement* embed = toHTMLEmbedElement(embedElement); | 71 HTMLEmbedElement* embed = toHTMLEmbedElement(embedElement); |
| 72 | 72 |
| 73 document().view()->updateAllLifecyclePhases(); | 73 document().view()->updateAllLifecyclePhases(); |
| 74 | 74 |
| 75 // We should get |true| as a result and don't trigger a DCHECK. | 75 // We should get |true| as a result and don't trigger a DCHECK. |
| 76 EXPECT_TRUE(static_cast<Element*>(embed)->layoutObjectIsNeeded( | 76 EXPECT_TRUE(static_cast<Element*>(embed)->layoutObjectIsNeeded( |
| 77 ComputedStyle::initialStyle())); | 77 ComputedStyle::initialStyle())); |
| 78 | 78 |
| 79 // This call will update fallback state of the object. | 79 // This call will update fallback state of the object. |
| 80 object->updateWidget(); | 80 object->updatePlugin(); |
| 81 | 81 |
| 82 EXPECT_TRUE(object->hasFallbackContent()); | 82 EXPECT_TRUE(object->hasFallbackContent()); |
| 83 EXPECT_TRUE(object->useFallbackContent()); | 83 EXPECT_TRUE(object->useFallbackContent()); |
| 84 EXPECT_TRUE(object->willUseFallbackContentAtLayout()); | 84 EXPECT_TRUE(object->willUseFallbackContentAtLayout()); |
| 85 | 85 |
| 86 document().view()->updateAllLifecyclePhases(); | 86 document().view()->updateAllLifecyclePhases(); |
| 87 EXPECT_TRUE(static_cast<Element*>(embed)->layoutObjectIsNeeded( | 87 EXPECT_TRUE(static_cast<Element*>(embed)->layoutObjectIsNeeded( |
| 88 ComputedStyle::initialStyle())); | 88 ComputedStyle::initialStyle())); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |