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

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

Issue 2007373004: Fix test expectations to use bool checks rather than null compares (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/spdy/spdy_stream_unittest.cc ('k') | remoting/protocol/fake_datagram_socket.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 <memory> 10 #include <memory>
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 storage_.set_http_transaction_factory(base::WrapUnique( 488 storage_.set_http_transaction_factory(base::WrapUnique(
489 new HttpCache(storage_.http_network_session(), 489 new HttpCache(storage_.http_network_session(),
490 HttpCache::DefaultBackend::InMemory(0), false))); 490 HttpCache::DefaultBackend::InMemory(0), false)));
491 } 491 }
492 492
493 SpdyURLRequestContext::~SpdyURLRequestContext() { 493 SpdyURLRequestContext::~SpdyURLRequestContext() {
494 AssertNoURLRequests(); 494 AssertNoURLRequests();
495 } 495 }
496 496
497 bool HasSpdySession(SpdySessionPool* pool, const SpdySessionKey& key) { 497 bool HasSpdySession(SpdySessionPool* pool, const SpdySessionKey& key) {
498 return pool->FindAvailableSession(key, GURL(), BoundNetLog()) != NULL; 498 return static_cast<bool>(
499 pool->FindAvailableSession(key, GURL(), BoundNetLog()));
499 } 500 }
500 501
501 namespace { 502 namespace {
502 503
503 base::WeakPtr<SpdySession> CreateSpdySessionHelper( 504 base::WeakPtr<SpdySession> CreateSpdySessionHelper(
504 HttpNetworkSession* http_session, 505 HttpNetworkSession* http_session,
505 const SpdySessionKey& key, 506 const SpdySessionKey& key,
506 const BoundNetLog& net_log, 507 const BoundNetLog& net_log,
507 Error expected_status, 508 Error expected_status,
508 bool is_secure) { 509 bool is_secure) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 545
545 if (rv == ERR_IO_PENDING) 546 if (rv == ERR_IO_PENDING)
546 rv = callback.WaitForResult(); 547 rv = callback.WaitForResult();
547 548
548 EXPECT_EQ(OK, rv); 549 EXPECT_EQ(OK, rv);
549 550
550 base::WeakPtr<SpdySession> spdy_session = 551 base::WeakPtr<SpdySession> spdy_session =
551 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( 552 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket(
552 key, std::move(connection), net_log, OK, is_secure); 553 key, std::move(connection), net_log, OK, is_secure);
553 // Failure is reported asynchronously. 554 // Failure is reported asynchronously.
554 EXPECT_TRUE(spdy_session != NULL); 555 EXPECT_TRUE(spdy_session);
555 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); 556 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key));
556 return spdy_session; 557 return spdy_session;
557 } 558 }
558 559
559 } // namespace 560 } // namespace
560 561
561 base::WeakPtr<SpdySession> CreateInsecureSpdySession( 562 base::WeakPtr<SpdySession> CreateInsecureSpdySession(
562 HttpNetworkSession* http_session, 563 HttpNetworkSession* http_session,
563 const SpdySessionKey& key, 564 const SpdySessionKey& key,
564 const BoundNetLog& net_log) { 565 const BoundNetLog& net_log) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 EXPECT_NE(expected_status, ERR_IO_PENDING); 648 EXPECT_NE(expected_status, ERR_IO_PENDING);
648 EXPECT_FALSE(HasSpdySession(pool, key)); 649 EXPECT_FALSE(HasSpdySession(pool, key));
649 std::unique_ptr<ClientSocketHandle> handle(new ClientSocketHandle()); 650 std::unique_ptr<ClientSocketHandle> handle(new ClientSocketHandle());
650 handle->SetSocket( 651 handle->SetSocket(
651 std::unique_ptr<StreamSocket>(new FakeSpdySessionClientSocket( 652 std::unique_ptr<StreamSocket>(new FakeSpdySessionClientSocket(
652 expected_status == OK ? ERR_IO_PENDING : expected_status))); 653 expected_status == OK ? ERR_IO_PENDING : expected_status)));
653 base::WeakPtr<SpdySession> spdy_session = 654 base::WeakPtr<SpdySession> spdy_session =
654 pool->CreateAvailableSessionFromSocket( 655 pool->CreateAvailableSessionFromSocket(
655 key, std::move(handle), BoundNetLog(), OK, true /* is_secure */); 656 key, std::move(handle), BoundNetLog(), OK, true /* is_secure */);
656 // Failure is reported asynchronously. 657 // Failure is reported asynchronously.
657 EXPECT_TRUE(spdy_session != NULL); 658 EXPECT_TRUE(spdy_session);
658 EXPECT_TRUE(HasSpdySession(pool, key)); 659 EXPECT_TRUE(HasSpdySession(pool, key));
659 return spdy_session; 660 return spdy_session;
660 } 661 }
661 662
662 } // namespace 663 } // namespace
663 664
664 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool, 665 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool,
665 const SpdySessionKey& key) { 666 const SpdySessionKey& key) {
666 return CreateFakeSpdySessionHelper(pool, key, OK); 667 return CreateFakeSpdySessionHelper(pool, key, OK);
667 } 668 }
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1315 }
1315 } 1316 }
1316 1317
1317 void SpdyTestUtil::SetPriority(RequestPriority priority, 1318 void SpdyTestUtil::SetPriority(RequestPriority priority,
1318 SpdySynStreamIR* ir) const { 1319 SpdySynStreamIR* ir) const {
1319 ir->set_priority(ConvertRequestPriorityToSpdyPriority( 1320 ir->set_priority(ConvertRequestPriorityToSpdyPriority(
1320 priority, spdy_version())); 1321 priority, spdy_version()));
1321 } 1322 }
1322 1323
1323 } // namespace net 1324 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | remoting/protocol/fake_datagram_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698