Chromium Code Reviews| Index: third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp |
| diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..23ffda4d0d8773afe3075fcc8ca148694ef8a273 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTimingTest.cpp |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/timing/PerformanceResourceTiming.h" |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace blink { |
| + |
| +class PerformanceResourceTimingTest : public ::testing::Test { |
| + protected: |
| + 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:
|
| + AtomicString connectionInfo = "http/1.1"; |
| + AtomicString alpnNegotiatedProtocol = "unknown"; |
| + return PerformanceResourceTiming::produceNextHopProtocol( |
| + alpnNegotiatedProtocol, connectionInfo) == connectionInfo; |
| + } |
| + |
| + bool reformatedWhenALPNIsQuicAndSpdy() { |
| + AtomicString connectionInfo = "http/1.1"; |
| + AtomicString alpnNegotiatedProtocol = "quic/1+spdy/3"; |
| + return PerformanceResourceTiming::produceNextHopProtocol( |
| + alpnNegotiatedProtocol, connectionInfo) == "http2/+quic/1"; |
| + } |
| + |
| + bool noChangeWhenOtherwise() { |
| + AtomicString connectionInfo = "http/1.1"; |
| + AtomicString alpnNegotiatedProtocol = "RandomProtocol"; |
| + return PerformanceResourceTiming::produceNextHopProtocol( |
| + alpnNegotiatedProtocol, connectionInfo) == |
| + alpnNegotiatedProtocol; |
| + } |
| +}; |
| + |
| +TEST_F(PerformanceResourceTimingTest, TestNextHopProtocol) { |
| + 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.
|
| + EXPECT_TRUE(reformatedWhenALPNIsQuicAndSpdy()); |
| + EXPECT_TRUE(noChangeWhenOtherwise()); |
| +} |
| +} |