Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp

Issue 1669493006: Incorrect setHasMediaQueries() when @media rule is dropped. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp b/third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dc7ce4ed6d4aab6fb9cceb4d9f0e925328959d1c
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/StyleSheetContentsTest.cpp
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/StyleSheetContents.h"
+
+#include "core/css/CSSTestHelper.h"
+#include "core/css/parser/CSSParser.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(StyleSheetContentsTest, InsertMediaRule)
+{
+ CSSParserContext context(HTMLStandardMode, nullptr);
+
+ RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::create(context);
+ styleSheet->parseString("@namespace ns url(test);");
+ EXPECT_EQ(1U, styleSheet->ruleCount());
+
+ styleSheet->setMutable();
+ styleSheet->wrapperInsertRule(CSSParser::parseRule(context, styleSheet, "@media all { div { color: pink } }"), 0);
+ EXPECT_EQ(1U, styleSheet->ruleCount());
+ EXPECT_FALSE(styleSheet->hasMediaQueries());
+
+ styleSheet->wrapperInsertRule(CSSParser::parseRule(context, styleSheet, "@media all { div { color: green } }"), 1);
+ EXPECT_EQ(2U, styleSheet->ruleCount());
+ EXPECT_TRUE(styleSheet->hasMediaQueries());
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698