Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / fetch / ClientHintsPreferencesTest.cpp
blob285ec4abd0fe5d7db93dd670daaa72db72550482
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "core/fetch/ClientHintsPreferences.h"
8 #include <gtest/gtest.h>
10 namespace blink {
12 class ClientHintsPreferencesTest : public ::testing::Test {
15 TEST_F(ClientHintsPreferencesTest, Basic)
17 struct TestCase {
18 const char* headerValue;
19 bool expectationResourceWidth;
20 bool expectationDPR;
21 bool expectationViewportWidth;
22 } cases[] = {
23 {"width, dpr, viewportWidth", true, true, false},
24 {"WiDtH, dPr, viewport-width", true, true, true},
25 {"WIDTH, DPR, VIWEPROT-Width", true, true, false},
26 {"VIewporT-Width, wutwut, width", true, false, true},
27 {"dprw", false, false, false},
28 {"DPRW", false, false, false},
31 for (const auto& testCase : cases) {
32 ClientHintsPreferences preferences;
33 const char* value = testCase.headerValue;
35 preferences.updateFromAcceptClientHintsHeader(value, nullptr);
36 EXPECT_EQ(testCase.expectationResourceWidth, preferences.shouldSendResourceWidth());
37 EXPECT_EQ(testCase.expectationDPR, preferences.shouldSendDPR());
38 EXPECT_EQ(testCase.expectationViewportWidth, preferences.shouldSendViewportWidth());
42 } // namespace blink