Index: third_party/WebKit/Source/core/dom/StyleEngineTest.cpp |
diff --git a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp |
index e53d7e7c0cbd1c474a85ef36580c62584050c0bf..887ffbb0e1d12f7e7bb849e184a4b5a6967c7b08 100644 |
--- a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp |
+++ b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp |
@@ -297,4 +297,28 @@ TEST_F(StyleEngineTest, RuleSetInvalidationV0BoundaryCrossing) { |
RuleSetInvalidationFullRecalc); |
} |
+TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { |
+ document().body()->setInnerHTML( |
+ "<style>div {}</style>" |
+ "<style id='sheet' media='(min-width: 200px)'>" |
+ " div {}" |
+ "</style>"); |
+ |
+ Element* styleElement = document().getElementById("sheet"); |
+ |
+ for (unsigned i = 0; i < 10; i++) { |
+ document().body()->removeChild(styleElement); |
+ document().view()->updateAllLifecyclePhases(); |
+ document().body()->appendChild(styleElement); |
+ document().view()->updateAllLifecyclePhases(); |
+ } |
+ |
+ EXPECT_TRUE(document().styleEngine().hasViewportDependentMediaQueries()); |
+ |
+ document().body()->removeChild(styleElement); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ EXPECT_FALSE(document().styleEngine().hasViewportDependentMediaQueries()); |
+} |
+ |
} // namespace blink |