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

Side by Side Diff: net/http/http_response_body_drainer_unittest.cc

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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/http/http_network_transaction_unittest.cc ('k') | net/http/http_security_headers.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/http/http_response_body_drainer.h" 5 #include "net/http/http_response_body_drainer.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/base/test_completion_callback.h" 15 #include "net/base/test_completion_callback.h"
16 #include "net/http/http_network_session.h" 16 #include "net/http/http_network_session.h"
17 #include "net/http/http_server_properties_impl.h" 17 #include "net/http/http_server_properties_impl.h"
18 #include "net/http/http_stream.h" 18 #include "net/http/http_stream.h"
19 #include "net/http/transport_security_state.h" 19 #include "net/http/transport_security_state.h"
20 #include "net/proxy/proxy_service.h" 20 #include "net/proxy/proxy_service.h"
21 #include "net/ssl/ssl_config_service_defaults.h" 21 #include "net/ssl/ssl_config_service_defaults.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace net { 24 namespace net {
25 25
26 namespace { 26 namespace {
27 27
28 const int kMagicChunkSize = 1024; 28 const int kMagicChunkSize = 1024;
29 COMPILE_ASSERT( 29 static_assert((HttpResponseBodyDrainer::kDrainBodyBufferSize %
30 (HttpResponseBodyDrainer::kDrainBodyBufferSize % kMagicChunkSize) == 0, 30 kMagicChunkSize) == 0,
31 chunk_size_needs_to_divide_evenly_into_buffer_size); 31 "chunk size needs to divide evenly into buffer size");
32 32
33 class CloseResultWaiter { 33 class CloseResultWaiter {
34 public: 34 public:
35 CloseResultWaiter() 35 CloseResultWaiter()
36 : result_(false), 36 : result_(false),
37 have_result_(false), 37 have_result_(false),
38 waiting_for_result_(false) {} 38 waiting_for_result_(false) {}
39 39
40 int WaitForResult() { 40 int WaitForResult() {
41 CHECK(!waiting_for_result_); 41 CHECK(!waiting_for_result_);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 too_many_chunks += 1; // Now it's too large. 299 too_many_chunks += 1; // Now it's too large.
300 300
301 mock_stream_->set_num_chunks(too_many_chunks); 301 mock_stream_->set_num_chunks(too_many_chunks);
302 drainer_->Start(session_.get()); 302 drainer_->Start(session_.get());
303 EXPECT_TRUE(result_waiter_.WaitForResult()); 303 EXPECT_TRUE(result_waiter_.WaitForResult());
304 } 304 }
305 305
306 } // namespace 306 } // namespace
307 307
308 } // namespace net 308 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_security_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698