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

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

Issue 1904523002: Fix double comparisons for Media Queries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unreachable build error Created 4 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/MediaQueryEvaluatorTest.cpp
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
index 2cb2eb3685bdc8c70c223c15ab4aa1d16075b3cc..3f4fdab9d954b44d6465d509eff822e72b6279c6 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
@@ -115,6 +115,18 @@ TestCase floatViewportTestCases[] = {
{0, 0} // Do not remove the terminator line.
};
+TestCase floatNonFriendlyViewportTestCases[] = {
+ {"(min-width: 821px)", 1},
+ {"(max-width: 821px)", 1},
+ {"(width: 821px)", 1},
+ {"(min-height: 821px)", 1},
+ {"(max-height: 821px)", 1},
+ {"(height: 821px)", 1},
+ {"(width: 100vw)", 1},
+ {"(height: 100vh)", 1},
+ {0, 0} // Do not remove the terminator line.
+};
+
TestCase printTestCases[] = {
{"print and (min-resolution: 1dppx)", 1},
{"print and (min-resolution: 118dpcm)", 1},
@@ -127,7 +139,7 @@ void testMQEvaluator(TestCase* testCases, const MediaQueryEvaluator& mediaQueryE
Persistent<MediaQuerySet> querySet = nullptr;
for (unsigned i = 0; testCases[i].input; ++i) {
querySet = MediaQuerySet::create(testCases[i].input);
- ASSERT_EQ(testCases[i].output, mediaQueryEvaluator.eval(querySet.get()));
+ EXPECT_EQ(testCases[i].output, mediaQueryEvaluator.eval(querySet.get()));
}
}
@@ -193,4 +205,15 @@ TEST(MediaQueryEvaluatorTest, CachedFloatViewport)
testMQEvaluator(floatViewportTestCases, mediaQueryEvaluator);
}
+TEST(MediaQueryEvaluatorTest, CachedFloatViewportNonFloatFriendly)
+{
+ MediaValuesCached::MediaValuesCachedData data;
+ data.viewportWidth = 821;
+ data.viewportHeight = 821;
+ MediaValues* mediaValues = MediaValuesCached::create(data);
+
+ MediaQueryEvaluator mediaQueryEvaluator(*mediaValues);
+ testMQEvaluator(floatNonFriendlyViewportTestCases, mediaQueryEvaluator);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp ('k') | third_party/WebKit/Source/core/css/MediaValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698