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

Side by Side Diff: net/quic/core/quic_data_writer_test.cc

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 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 | « net/quic/core/quic_crypto_stream_test.cc ('k') | net/quic/core/quic_error_codes_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/quic/core/quic_data_writer.h" 5 #include "net/quic/core/quic_data_writer.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 8
9 #include "net/quic/core/quic_data_reader.h" 9 #include "net/quic/core/quic_data_reader.h"
10 #include "net/quic/core/quic_utils.h" 10 #include "net/quic/core/quic_utils.h"
11 #include "net/quic/platform/api/quic_flags.h" 11 #include "net/quic/platform/api/quic_flags.h"
12 #include "net/quic/platform/api/quic_test.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 13 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace net { 15 namespace net {
16 namespace test { 16 namespace test {
17 namespace { 17 namespace {
18 18
19 char* AsChars(unsigned char* data) { 19 char* AsChars(unsigned char* data) {
20 return reinterpret_cast<char*>(data); 20 return reinterpret_cast<char*>(data);
21 } 21 }
22 22
23 struct TestParams { 23 struct TestParams {
24 TestParams(Perspective perspective, Endianness endianness) 24 TestParams(Perspective perspective, Endianness endianness)
25 : perspective(perspective), endianness(endianness) {} 25 : perspective(perspective), endianness(endianness) {}
26 26
27 Perspective perspective; 27 Perspective perspective;
28 Endianness endianness; 28 Endianness endianness;
29 }; 29 };
30 30
31 std::vector<TestParams> GetTestParams() { 31 std::vector<TestParams> GetTestParams() {
32 std::vector<TestParams> params; 32 std::vector<TestParams> params;
33 for (Perspective perspective : 33 for (Perspective perspective :
34 {Perspective::IS_CLIENT, Perspective::IS_SERVER}) { 34 {Perspective::IS_CLIENT, Perspective::IS_SERVER}) {
35 for (Endianness endianness : {NETWORK_BYTE_ORDER, HOST_BYTE_ORDER}) { 35 for (Endianness endianness : {NETWORK_BYTE_ORDER, HOST_BYTE_ORDER}) {
36 params.push_back(TestParams(perspective, endianness)); 36 params.push_back(TestParams(perspective, endianness));
37 } 37 }
38 } 38 }
39 return params; 39 return params;
40 } 40 }
41 41
42 class QuicDataWriterTest : public ::testing::TestWithParam<TestParams> {}; 42 class QuicDataWriterTest : public QuicTestWithParam<TestParams> {};
43 43
44 INSTANTIATE_TEST_CASE_P(QuicDataWriterTests, 44 INSTANTIATE_TEST_CASE_P(QuicDataWriterTests,
45 QuicDataWriterTest, 45 QuicDataWriterTest,
46 ::testing::ValuesIn(GetTestParams())); 46 ::testing::ValuesIn(GetTestParams()));
47 47
48 TEST_P(QuicDataWriterTest, SanityCheckUFloat16Consts) { 48 TEST_P(QuicDataWriterTest, SanityCheckUFloat16Consts) {
49 // Check the arithmetic on the constants - otherwise the values below make 49 // Check the arithmetic on the constants - otherwise the values below make
50 // no sense. 50 // no sense.
51 EXPECT_EQ(30, kUFloat16MaxExponent); 51 EXPECT_EQ(30, kUFloat16MaxExponent);
52 EXPECT_EQ(11, kUFloat16MantissaBits); 52 EXPECT_EQ(11, kUFloat16MantissaBits);
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 break; 590 break;
591 default: 591 default:
592 EXPECT_FALSE(reader.ReadBytesToUInt64(i, &read64)); 592 EXPECT_FALSE(reader.ReadBytesToUInt64(i, &read64));
593 } 593 }
594 } 594 }
595 } 595 }
596 596
597 } // namespace 597 } // namespace
598 } // namespace test 598 } // namespace test
599 } // namespace net 599 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_stream_test.cc ('k') | net/quic/core/quic_error_codes_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698