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

Side by Side Diff: third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp

Issue 2962113002: Updates to Server-Timing in accordance with with spec changes (Closed)
Patch Set: fix web-platform-tests Created 3 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/platform/network/HTTPParsers.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/network/HTTPParsers.h" 5 #include "platform/network/HTTPParsers.h"
6 6
7 #include "platform/heap/Handle.h" 7 #include "platform/heap/Handle.h"
8 #include "platform/loader/fetch/ResourceResponse.h" 8 #include "platform/loader/fetch/ResourceResponse.h"
9 #include "platform/weborigin/Suborigin.h" 9 #include "platform/weborigin/Suborigin.h"
10 #include "platform/wtf/MathExtras.h" 10 #include "platform/wtf/MathExtras.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 void testServerTimingHeader(const char* headerValue, 480 void testServerTimingHeader(const char* headerValue,
481 Vector<Vector<String>> expectedResults) { 481 Vector<Vector<String>> expectedResults) {
482 std::unique_ptr<ServerTimingHeaderVector> results = 482 std::unique_ptr<ServerTimingHeaderVector> results =
483 ParseServerTimingHeader(headerValue); 483 ParseServerTimingHeader(headerValue);
484 EXPECT_EQ((*results).size(), expectedResults.size()); 484 EXPECT_EQ((*results).size(), expectedResults.size());
485 unsigned i = 0; 485 unsigned i = 0;
486 for (const auto& header : *results) { 486 for (const auto& header : *results) {
487 Vector<String> expectedResult = expectedResults[i++]; 487 Vector<String> expectedResult = expectedResults[i++];
488 EXPECT_EQ(header->metric, expectedResult[0]); 488 EXPECT_EQ(header->metric, expectedResult[0]);
489 EXPECT_EQ(header->duration, expectedResult[1].ToDouble()); 489 EXPECT_EQ(header->value, expectedResult[1].ToDouble());
490 EXPECT_EQ(header->description, expectedResult[2]); 490 EXPECT_EQ(header->description, expectedResult[2]);
491 } 491 }
492 } 492 }
493 493
494 TEST(HTTPParsersTest, ParseServerTimingHeader) { 494 TEST(HTTPParsersTest, ParseServerTimingHeader) {
495 testServerTimingHeader("", {}); 495 testServerTimingHeader("", {});
496 testServerTimingHeader("metric", {{"metric", "0", ""}}); 496 testServerTimingHeader("metric", {{"metric", "0", ""}});
497 testServerTimingHeader("metric,", {{"metric", "0", ""}}); 497 testServerTimingHeader("metric,", {{"metric", "0", ""}});
498 testServerTimingHeader("metric ,", {{"metric", "0", ""}}); 498 testServerTimingHeader("metric ,", {{"metric", "0", ""}});
499 testServerTimingHeader("metric;", {{"metric", "0", ""}}); 499 testServerTimingHeader("metric;", {{"metric", "0", ""}});
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 // quoted-string 966 // quoted-string
967 testServerTimingHeader("metric;\"\"", {{"metric", "0", ""}}); 967 testServerTimingHeader("metric;\"\"", {{"metric", "0", ""}});
968 testServerTimingHeader("metric;\"\"\"", {{"metric", "0", ""}}); 968 testServerTimingHeader("metric;\"\"\"", {{"metric", "0", ""}});
969 testServerTimingHeader("metric;\"\\\"\"", {{"metric", "0", "\""}}); 969 testServerTimingHeader("metric;\"\\\"\"", {{"metric", "0", "\""}});
970 testServerTimingHeader("metric;\"\\\\\"\"", {{"metric", "0", "\\"}}); 970 testServerTimingHeader("metric;\"\\\\\"\"", {{"metric", "0", "\\"}});
971 testServerTimingHeader("metric;\"\\\\\\\"\"", {{"metric", "0", "\\\""}}); 971 testServerTimingHeader("metric;\"\\\\\\\"\"", {{"metric", "0", "\\\""}});
972 } 972 }
973 973
974 } // namespace blink 974 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/network/HTTPParsers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698