Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 AtomicString produceNextHopProtocol( | |
| 14 const AtomicString& alpnNegotiatedProtocol, | |
| 15 const AtomicString& connectionInfo) { | |
| 16 return PerformanceResourceTiming::produceNextHopProtocol( | |
| 17 alpnNegotiatedProtocol, connectionInfo); | |
| 18 } | |
| 19 }; | |
| 20 | |
| 21 TEST_F(PerformanceResourceTimingTest, | |
| 22 TestFallbackToConnectionInfoWhenALPNUnknown) { | |
| 23 AtomicString connectionInfo = "http/1.1"; | |
|
panicker
2016/10/26 20:35:06
Add another test for when connectionInfo is also "
sunjian
2016/10/27 20:41:29
Done.
| |
| 24 AtomicString alpnNegotiatedProtocol = "unknown"; | |
| 25 EXPECT_EQ(produceNextHopProtocol(alpnNegotiatedProtocol, connectionInfo), | |
| 26 connectionInfo); | |
| 27 } | |
| 28 | |
| 29 TEST_F(PerformanceResourceTimingTest, TestReformatedWhenALPNIsQuicAndSpdy) { | |
| 30 AtomicString connectionInfo = "http/1.1"; | |
| 31 AtomicString alpnNegotiatedProtocol = "quic/1+spdy/3"; | |
|
panicker
2016/10/26 20:35:06
Add test case with quic string without spdy?
Or is
sunjian
2016/10/27 20:41:29
Done.
| |
| 32 EXPECT_EQ(produceNextHopProtocol(alpnNegotiatedProtocol, connectionInfo), | |
| 33 "http2/+quic/1"); | |
| 34 } | |
| 35 | |
| 36 TEST_F(PerformanceResourceTimingTest, TestNoChangeWhenOtherwise) { | |
| 37 AtomicString connectionInfo = "http/1.1"; | |
| 38 AtomicString alpnNegotiatedProtocol = "RandomProtocol"; | |
| 39 EXPECT_EQ(produceNextHopProtocol(alpnNegotiatedProtocol, connectionInfo), | |
| 40 alpnNegotiatedProtocol); | |
| 41 } | |
| 42 } | |
| OLD | NEW |