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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ClientHintsPreferencesTest.cpp

Issue 2584423002: Loading: move core/fetch to platform/loader/fetch (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "core/fetch/ClientHintsPreferences.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace blink {
10
11 class ClientHintsPreferencesTest : public ::testing::Test {};
12
13 TEST_F(ClientHintsPreferencesTest, Basic) {
14 struct TestCase {
15 const char* headerValue;
16 bool expectationResourceWidth;
17 bool expectationDPR;
18 bool expectationViewportWidth;
19 } cases[] = {
20 {"width, dpr, viewportWidth", true, true, false},
21 {"WiDtH, dPr, viewport-width", true, true, true},
22 {"WIDTH, DPR, VIWEPROT-Width", true, true, false},
23 {"VIewporT-Width, wutwut, width", true, false, true},
24 {"dprw", false, false, false},
25 {"DPRW", false, false, false},
26 };
27
28 for (const auto& testCase : cases) {
29 ClientHintsPreferences preferences;
30 const char* value = testCase.headerValue;
31
32 preferences.updateFromAcceptClientHintsHeader(value, nullptr);
33 EXPECT_EQ(testCase.expectationResourceWidth,
34 preferences.shouldSendResourceWidth());
35 EXPECT_EQ(testCase.expectationDPR, preferences.shouldSendDPR());
36 EXPECT_EQ(testCase.expectationViewportWidth,
37 preferences.shouldSendViewportWidth());
38 }
39 }
40
41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698