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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp

Issue 2429063002: Implement nextHopProtocol in PerformanceResourceTiming and PerformanceNavigationTiming.
Patch Set: Added core_export for PerformanceResourceTiming Created 4 years, 1 month 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 2016 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/timing/PerformanceResourceTiming.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace blink {
10
11 class PerformanceResourceTimingTest : public ::testing::Test {
12 protected:
13 bool fallbackToConnectionInfoWhenALPNUnknown() {
panicker 2016/10/25 23:53:26 move these inline into tests.
sunjian 2016/10/26 19:56:52 I tried to do that. But PerformanceResourceTiming:
14 AtomicString connectionInfo = "http/1.1";
15 AtomicString alpnNegotiatedProtocol = "unknown";
16 return PerformanceResourceTiming::produceNextHopProtocol(
17 alpnNegotiatedProtocol, connectionInfo) == connectionInfo;
18 }
19
20 bool reformatedWhenALPNIsQuicAndSpdy() {
21 AtomicString connectionInfo = "http/1.1";
22 AtomicString alpnNegotiatedProtocol = "quic/1+spdy/3";
23 return PerformanceResourceTiming::produceNextHopProtocol(
24 alpnNegotiatedProtocol, connectionInfo) == "http2/+quic/1";
25 }
26
27 bool noChangeWhenOtherwise() {
28 AtomicString connectionInfo = "http/1.1";
29 AtomicString alpnNegotiatedProtocol = "RandomProtocol";
30 return PerformanceResourceTiming::produceNextHopProtocol(
31 alpnNegotiatedProtocol, connectionInfo) ==
32 alpnNegotiatedProtocol;
33 }
34 };
35
36 TEST_F(PerformanceResourceTimingTest, TestNextHopProtocol) {
37 EXPECT_TRUE(fallbackToConnectionInfoWhenALPNUnknown());
panicker 2016/10/25 23:53:26 (see previous comment) use EXPECT_EQ inline
sunjian 2016/10/26 19:56:52 Same reason as above.
38 EXPECT_TRUE(reformatedWhenALPNIsQuicAndSpdy());
39 EXPECT_TRUE(noChangeWhenOtherwise());
40 }
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698