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

Side by Side Diff: util/net/http_body_test.cc

Issue 700383007: Use implicit_cast<> instead of static_cast<> whenever possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 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
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 28 matching lines...) Expand all
39 EXPECT_EQ(0, stream.GetBytesBuffer(buf, sizeof(buf))); 39 EXPECT_EQ(0, stream.GetBytesBuffer(buf, sizeof(buf)));
40 ExpectBufferSet(buf, '!', sizeof(buf)); 40 ExpectBufferSet(buf, '!', sizeof(buf));
41 } 41 }
42 42
43 TEST(StringHTTPBodyStream, SmallString) { 43 TEST(StringHTTPBodyStream, SmallString) {
44 uint8_t buf[32]; 44 uint8_t buf[32];
45 memset(buf, '!', sizeof(buf)); 45 memset(buf, '!', sizeof(buf));
46 46
47 std::string string("Hello, world"); 47 std::string string("Hello, world");
48 StringHTTPBodyStream stream(string); 48 StringHTTPBodyStream stream(string);
49 EXPECT_EQ(static_cast<ssize_t>(string.length()), 49 EXPECT_EQ(implicit_cast<ssize_t>(string.length()),
50 stream.GetBytesBuffer(buf, sizeof(buf))); 50 stream.GetBytesBuffer(buf, sizeof(buf)));
51 51
52 std::string actual(reinterpret_cast<const char*>(buf), string.length()); 52 std::string actual(reinterpret_cast<const char*>(buf), string.length());
53 EXPECT_EQ(string, actual); 53 EXPECT_EQ(string, actual);
54 ExpectBufferSet(buf + string.length(), '!', sizeof(buf) - string.length()); 54 ExpectBufferSet(buf + string.length(), '!', sizeof(buf) - string.length());
55 55
56 EXPECT_EQ(0, stream.GetBytesBuffer(buf, sizeof(buf))); 56 EXPECT_EQ(0, stream.GetBytesBuffer(buf, sizeof(buf)));
57 } 57 }
58 58
59 TEST(StringHTTPBodyStream, MultipleReads) { 59 TEST(StringHTTPBodyStream, MultipleReads) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 EXPECT_EQ(expected_string, actual_string); 212 EXPECT_EQ(expected_string, actual_string);
213 } 213 }
214 214
215 INSTANTIATE_TEST_CASE_P(VariableBufferSize, 215 INSTANTIATE_TEST_CASE_P(VariableBufferSize,
216 CompositeHTTPBodyStreamBufferSize, 216 CompositeHTTPBodyStreamBufferSize,
217 testing::Values(1, 2, 9, 16, 31, 128)); 217 testing::Values(1, 2, 9, 16, 31, 128));
218 218
219 } // namespace 219 } // namespace
220 } // namespace test 220 } // namespace test
221 } // namespace crashpad 221 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698