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

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

Issue 2829873002: Collect media query results for non-matching stylesheets. (Closed)
Patch Set: Created 3 years, 8 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
Index: third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
diff --git a/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp b/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
index af1c54ca2cb7169d13f6ce2498d84bc0a5f02b6a..1187aa3c1af7f84e9026ac4bbd29b085640a0264 100644
--- a/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
+++ b/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp
@@ -10,6 +10,7 @@
#include "core/css/StyleSheetContents.h"
#include "core/css/StyleSheetList.h"
#include "core/css/parser/CSSParserContext.h"
+#include "core/css/parser/MediaQueryParser.h"
#include "core/dom/StyleEngine.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/dom/shadow/ShadowRootInit.h"
@@ -409,6 +410,35 @@ TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_DisableAndAppend) {
EXPECT_EQ(2u, changed_rule_sets.size());
}
+TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_AddRemoveNonMatchingMQ) {
+ ActiveStyleSheetVector old_sheets;
+ ActiveStyleSheetVector new_sheets;
+ HeapHashSet<Member<RuleSet>> changed_rule_sets;
+
+ EXPECT_EQ(
+ kNoActiveSheetsChanged,
+ CompareActiveStyleSheets(old_sheets, new_sheets, changed_rule_sets));
+ EXPECT_EQ(0u, changed_rule_sets.size());
+
+ CSSStyleSheet* sheet1 = CreateSheet();
+ MediaQuerySet* mq =
+ MediaQueryParser::ParseMediaQuerySet("(min-width: 9000px)");
+ sheet1->SetMediaQueries(mq);
+ sheet1->MatchesMediaQueries(MediaQueryEvaluator());
+
+ new_sheets.push_back(std::make_pair(sheet1, nullptr));
+
+ EXPECT_EQ(
+ kActiveSheetsAppended,
+ CompareActiveStyleSheets(old_sheets, new_sheets, changed_rule_sets));
+ EXPECT_EQ(0u, changed_rule_sets.size());
+
+ EXPECT_EQ(
+ kActiveSheetsChanged,
+ CompareActiveStyleSheets(new_sheets, old_sheets, changed_rule_sets));
+ EXPECT_EQ(0u, changed_rule_sets.size());
+}
+
TEST_F(ApplyRulesetsTest, AddUniversalRuleToDocument) {
GetDocument().View()->UpdateAllLifecyclePhases();
« no previous file with comments | « third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp ('k') | third_party/WebKit/Source/core/css/CSSStyleSheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698