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

Side by Side Diff: net/spdy/spdy_test_util_common.cc

Issue 2109503009: Refactor net tests to use GMock matchers for checking net::Error results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to contents.txt files Created 4 years, 5 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/spdy/spdy_stream_unittest.cc ('k') | net/ssl/channel_id_service_unittest.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/spdy/spdy_test_util_common.h" 5 #include "net/spdy/spdy_test_util_common.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <utility> 10 #include <utility>
(...skipping 14 matching lines...) Expand all
25 #include "net/socket/socket_test_util.h" 25 #include "net/socket/socket_test_util.h"
26 #include "net/socket/ssl_client_socket.h" 26 #include "net/socket/ssl_client_socket.h"
27 #include "net/socket/transport_client_socket_pool.h" 27 #include "net/socket/transport_client_socket_pool.h"
28 #include "net/spdy/buffered_spdy_framer.h" 28 #include "net/spdy/buffered_spdy_framer.h"
29 #include "net/spdy/spdy_alt_svc_wire_format.h" 29 #include "net/spdy/spdy_alt_svc_wire_format.h"
30 #include "net/spdy/spdy_framer.h" 30 #include "net/spdy/spdy_framer.h"
31 #include "net/spdy/spdy_http_utils.h" 31 #include "net/spdy/spdy_http_utils.h"
32 #include "net/spdy/spdy_session.h" 32 #include "net/spdy/spdy_session.h"
33 #include "net/spdy/spdy_session_pool.h" 33 #include "net/spdy/spdy_session_pool.h"
34 #include "net/spdy/spdy_stream.h" 34 #include "net/spdy/spdy_stream.h"
35 #include "net/test/gtest_util.h"
35 #include "net/url_request/url_request_job_factory_impl.h" 36 #include "net/url_request/url_request_job_factory_impl.h"
37 #include "testing/gmock/include/gmock/gmock.h"
38
39 using net::test::IsOk;
36 40
37 namespace net { 41 namespace net {
38 42
39 namespace { 43 namespace {
40 44
41 bool next_proto_is_spdy(NextProto next_proto) { 45 bool next_proto_is_spdy(NextProto next_proto) {
42 return next_proto >= kProtoSPDYMinimumVersion && 46 return next_proto >= kProtoSPDYMinimumVersion &&
43 next_proto <= kProtoSPDYMaximumVersion; 47 next_proto <= kProtoSPDYMaximumVersion;
44 } 48 }
45 49
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 MEDIUM, ClientSocketPool::RespectLimits::ENABLED, 520 MEDIUM, ClientSocketPool::RespectLimits::ENABLED,
517 callback.callback(), 521 callback.callback(),
518 http_session->GetTransportSocketPool( 522 http_session->GetTransportSocketPool(
519 HttpNetworkSession::NORMAL_SOCKET_POOL), 523 HttpNetworkSession::NORMAL_SOCKET_POOL),
520 net_log); 524 net_log);
521 } 525 }
522 526
523 if (rv == ERR_IO_PENDING) 527 if (rv == ERR_IO_PENDING)
524 rv = callback.WaitForResult(); 528 rv = callback.WaitForResult();
525 529
526 EXPECT_EQ(OK, rv); 530 EXPECT_THAT(rv, IsOk());
527 531
528 base::WeakPtr<SpdySession> spdy_session = 532 base::WeakPtr<SpdySession> spdy_session =
529 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( 533 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket(
530 key, std::move(connection), net_log, OK, is_secure); 534 key, std::move(connection), net_log, OK, is_secure);
531 // Failure is reported asynchronously. 535 // Failure is reported asynchronously.
532 EXPECT_TRUE(spdy_session); 536 EXPECT_TRUE(spdy_session);
533 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); 537 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key));
534 return spdy_session; 538 return spdy_session;
535 } 539 }
536 540
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 } 1285 }
1282 } 1286 }
1283 1287
1284 void SpdyTestUtil::SetPriority(RequestPriority priority, 1288 void SpdyTestUtil::SetPriority(RequestPriority priority,
1285 SpdySynStreamIR* ir) const { 1289 SpdySynStreamIR* ir) const {
1286 ir->set_priority(ConvertRequestPriorityToSpdyPriority( 1290 ir->set_priority(ConvertRequestPriorityToSpdyPriority(
1287 priority, spdy_version())); 1291 priority, spdy_version()));
1288 } 1292 }
1289 1293
1290 } // namespace net 1294 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | net/ssl/channel_id_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698