diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 18:13:07 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 18:13:07 +0000 |
commit | 9b6fee14acedde5c6b627d5f9b691776fc8d868c (patch) | |
tree | 8cd3438dc3b6504066f89096e37db4cff4b903ed | |
parent | b1ed7b9beaf3069b54084c453da6db6bed56607c (diff) | |
download | chromium_src-9b6fee14acedde5c6b627d5f9b691776fc8d868c.zip chromium_src-9b6fee14acedde5c6b627d5f9b691776fc8d868c.tar.gz chromium_src-9b6fee14acedde5c6b627d5f9b691776fc8d868c.tar.bz2 |
Avoid potential "NULL used as int" warnings by changing ASSERT_EQ(NULL, ...) to ASSERT_TRUE(... == NULL). Patch by Jacob Mandelson (see http://codereview.chromium.org/202057 ), r=me.
BUG=none
TEST=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27511 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/field_trial_unittest.cc | 4 | ||||
-rw-r--r-- | base/waitable_event_watcher_unittest.cc | 6 | ||||
-rw-r--r-- | base/weak_ptr_unittest.cc | 10 | ||||
-rw-r--r-- | chrome/browser/net/resolve_proxy_msg_helper_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/common/extensions/extension_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/common/property_bag_unittest.cc | 10 | ||||
-rw-r--r-- | media/audio/linux/alsa_output_unittest.cc | 2 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer_unittest.cc | 4 | ||||
-rw-r--r-- | net/base/host_cache_unittest.cc | 34 | ||||
-rw-r--r-- | net/base/ssl_client_auth_cache_unittest.cc | 6 | ||||
-rw-r--r-- | net/ftp/ftp_auth_cache_unittest.cc | 12 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 10 | ||||
-rw-r--r-- | net/proxy/single_threaded_proxy_resolver_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 9 |
14 files changed, 59 insertions, 62 deletions
diff --git a/base/field_trial_unittest.cc b/base/field_trial_unittest.cc index 430fd67..671376d 100644 --- a/base/field_trial_unittest.cc +++ b/base/field_trial_unittest.cc @@ -160,8 +160,8 @@ TEST_F(FieldTrialTest, Save) { } TEST_F(FieldTrialTest, Restore) { - EXPECT_EQ(NULL, FieldTrialList::Find("Some_name")); - EXPECT_EQ(NULL, FieldTrialList::Find("xxx")); + EXPECT_TRUE(FieldTrialList::Find("Some_name") == NULL); + EXPECT_TRUE(FieldTrialList::Find("xxx") == NULL); FieldTrialList::StringAugmentsState("Some_name/Winner/xxx/yyyy/"); diff --git a/base/waitable_event_watcher_unittest.cc b/base/waitable_event_watcher_unittest.cc index 049de38..c1d930a 100644 --- a/base/waitable_event_watcher_unittest.cc +++ b/base/waitable_event_watcher_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -38,7 +38,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { WaitableEvent event(true, false); WaitableEventWatcher watcher; - EXPECT_EQ(NULL, watcher.GetWatchedEvent()); + EXPECT_TRUE(watcher.GetWatchedEvent() == NULL); QuitDelegate delegate; watcher.StartWatching(&event, &delegate); @@ -48,7 +48,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { MessageLoop::current()->Run(); - EXPECT_EQ(NULL, watcher.GetWatchedEvent()); + EXPECT_TRUE(watcher.GetWatchedEvent() == NULL); } void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { diff --git a/base/weak_ptr_unittest.cc b/base/weak_ptr_unittest.cc index 4f53358..6d38caa 100644 --- a/base/weak_ptr_unittest.cc +++ b/base/weak_ptr_unittest.cc @@ -54,13 +54,13 @@ TEST(WeakPtrTest, Comparison) { TEST(WeakPtrTest, OutOfScope) { WeakPtr<int> ptr; - EXPECT_EQ(NULL, ptr.get()); + EXPECT_TRUE(ptr.get() == NULL); { int data; WeakPtrFactory<int> factory(&data); ptr = factory.GetWeakPtr(); } - EXPECT_EQ(NULL, ptr.get()); + EXPECT_TRUE(ptr.get() == NULL); } TEST(WeakPtrTest, Multiple) { @@ -73,8 +73,8 @@ TEST(WeakPtrTest, Multiple) { EXPECT_EQ(&data, a.get()); EXPECT_EQ(&data, b.get()); } - EXPECT_EQ(NULL, a.get()); - EXPECT_EQ(NULL, b.get()); + EXPECT_TRUE(a.get() == NULL); + EXPECT_TRUE(b.get() == NULL); } TEST(WeakPtrTest, UpCast) { @@ -98,7 +98,7 @@ TEST(WeakPtrTest, InvalidateWeakPtrs) { EXPECT_EQ(&data, ptr.get()); EXPECT_TRUE(factory.HasWeakPtrs()); factory.InvalidateWeakPtrs(); - EXPECT_EQ(NULL, ptr.get()); + EXPECT_TRUE(ptr.get() == NULL); EXPECT_FALSE(factory.HasWeakPtrs()); } diff --git a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc index 9e79623..b6132f9 100644 --- a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc +++ b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc @@ -225,7 +225,7 @@ TEST(ResolveProxyMsgHelperTest, CancelPendingRequests) { EXPECT_EQ(0u, resolver->pending_requests().size()); - EXPECT_EQ(NULL, delegate.pending_result()); + EXPECT_TRUE(delegate.pending_result() == NULL); // It should also be the case that msg1, msg2, msg3 were deleted by the // cancellation. (Else will show up as a leak in Purify/Valgrind). diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 249c719..43e116f 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -283,14 +283,14 @@ TEST(ExtensionTest, LoadPageActionHelper) { DictionaryValue input; // First try with an empty dictionary. We should get nothing back. - ASSERT_EQ(NULL, extension.LoadExtensionActionHelper( - &input, 0, &error_msg, ExtensionAction::PAGE_ACTION)); + ASSERT_TRUE(extension.LoadExtensionActionHelper( + &input, 0, &error_msg, ExtensionAction::PAGE_ACTION) == NULL); ASSERT_STRNE("", error_msg.c_str()); error_msg = ""; // Now try the same, but as a browser action. Ensure same results. - ASSERT_EQ(NULL, extension.LoadExtensionActionHelper( - &input, 0, &error_msg, ExtensionAction::BROWSER_ACTION)); + ASSERT_TRUE(extension.LoadExtensionActionHelper( + &input, 0, &error_msg, ExtensionAction::BROWSER_ACTION) == NULL); ASSERT_STRNE("", error_msg.c_str()); error_msg = ""; diff --git a/chrome/common/property_bag_unittest.cc b/chrome/common/property_bag_unittest.cc index 51db07c..f63bbc2 100644 --- a/chrome/common/property_bag_unittest.cc +++ b/chrome/common/property_bag_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ TEST(PropertyBagTest, AddQueryRemove) { PropertyAccessor<int> adaptor; // Should be no match initially. - EXPECT_EQ(NULL, adaptor.GetProperty(&bag)); + EXPECT_TRUE(adaptor.GetProperty(&bag) == NULL); // Add the value and make sure we get it back. const int kFirstValue = 1; @@ -26,7 +26,7 @@ TEST(PropertyBagTest, AddQueryRemove) { // Remove the value and make sure it's gone. adaptor.DeleteProperty(&bag); - EXPECT_EQ(NULL, adaptor.GetProperty(&bag)); + EXPECT_TRUE(adaptor.GetProperty(&bag) == NULL); } TEST(PropertyBagTest, Copy) { @@ -57,6 +57,6 @@ TEST(PropertyBagTest, Copy) { // Clear it out, neither property should be left. copy = PropertyBag(); - EXPECT_EQ(NULL, adaptor1.GetProperty(©)); - EXPECT_EQ(NULL, adaptor2.GetProperty(©)); + EXPECT_TRUE(adaptor1.GetProperty(©) == NULL); + EXPECT_TRUE(adaptor2.GetProperty(©) == NULL); } diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index d13da89..e20526e 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -215,7 +215,7 @@ TEST_F(AlsaPcmOutputStreamTest, OpenClose) { test_stream_->Close(); message_loop_.RunAllPending(); - EXPECT_EQ(NULL, test_stream_->playback_handle_); + EXPECT_TRUE(test_stream_->playback_handle_ == NULL); EXPECT_FALSE(test_stream_->packet_.get()); EXPECT_TRUE(test_stream_->stop_stream_); } diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index 2bea53a..6a233b6 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -396,7 +396,7 @@ TEST_F(FFmpegDemuxerTest, Read) { EXPECT_TRUE(reader->called()); ASSERT_TRUE(reader->buffer()); EXPECT_TRUE(reader->buffer()->IsEndOfStream()); - EXPECT_EQ(NULL, reader->buffer()->GetData()); + EXPECT_TRUE(reader->buffer()->GetData() == NULL); EXPECT_EQ(0u, reader->buffer()->GetDataSize()); // Manually release buffer, which should release any remaining AVPackets. @@ -410,7 +410,7 @@ TEST_F(FFmpegDemuxerTest, Read) { EXPECT_TRUE(reader->called()); ASSERT_TRUE(reader->buffer()); EXPECT_TRUE(reader->buffer()->IsEndOfStream()); - EXPECT_EQ(NULL, reader->buffer()->GetData()); + EXPECT_TRUE(reader->buffer()->GetData() == NULL); EXPECT_EQ(0u, reader->buffer()->GetDataSize()); // Manually release buffer, which should release any remaining AVPackets. diff --git a/net/base/host_cache_unittest.cc b/net/base/host_cache_unittest.cc index fe01e20..2259185 100644 --- a/net/base/host_cache_unittest.cc +++ b/net/base/host_cache_unittest.cc @@ -28,17 +28,17 @@ TEST(HostCacheTest, Basic) { EXPECT_EQ(0U, cache.size()); // Add an entry for "foobar.com" at t=0. - EXPECT_EQ(NULL, cache.Lookup("foobar.com", base::TimeTicks())); + EXPECT_TRUE(cache.Lookup("foobar.com", base::TimeTicks()) == NULL); cache.Set("foobar.com", OK, AddressList(), now); entry1 = cache.Lookup("foobar.com", base::TimeTicks()); - EXPECT_FALSE(NULL == entry1); + EXPECT_FALSE(entry1 == NULL); EXPECT_EQ(1U, cache.size()); // Advance to t=5. now += base::TimeDelta::FromSeconds(5); // Add an entry for "foobar2.com" at t=5. - EXPECT_EQ(NULL, cache.Lookup("foobar2.com", base::TimeTicks())); + EXPECT_TRUE(cache.Lookup("foobar2.com", base::TimeTicks()) == NULL); cache.Set("foobar2.com", OK, AddressList(), now); entry2 = cache.Lookup("foobar2.com", base::TimeTicks()); EXPECT_FALSE(NULL == entry1); @@ -54,7 +54,7 @@ TEST(HostCacheTest, Basic) { // Advance to t=10; entry1 is now expired. now += base::TimeDelta::FromSeconds(1); - EXPECT_EQ(NULL, cache.Lookup("foobar.com", now)); + EXPECT_TRUE(cache.Lookup("foobar.com", now) == NULL); EXPECT_EQ(entry2, cache.Lookup("foobar2.com", now)); // Update entry1, so it is no longer expired. @@ -70,8 +70,8 @@ TEST(HostCacheTest, Basic) { // Advance to t=20; both entries are now expired. now += base::TimeDelta::FromSeconds(10); - EXPECT_EQ(NULL, cache.Lookup("foobar.com", now)); - EXPECT_EQ(NULL, cache.Lookup("foobar2.com", now)); + EXPECT_TRUE(cache.Lookup("foobar.com", now) == NULL); + EXPECT_TRUE(cache.Lookup("foobar2.com", now) == NULL); } // Try caching entries for a failed resolve attempt. @@ -81,19 +81,19 @@ TEST(HostCacheTest, NegativeEntry) { // Set t=0. base::TimeTicks now; - EXPECT_EQ(NULL, cache.Lookup("foobar.com", base::TimeTicks())); + EXPECT_TRUE(cache.Lookup("foobar.com", base::TimeTicks()) == NULL); cache.Set("foobar.com", ERR_NAME_NOT_RESOLVED, AddressList(), now); EXPECT_EQ(1U, cache.size()); // We disallow use of negative entries. - EXPECT_EQ(NULL, cache.Lookup("foobar.com", now)); + EXPECT_TRUE(cache.Lookup("foobar.com", now) == NULL); // Now overwrite with a valid entry, and then overwrite with negative entry // again -- the valid entry should be kicked out. cache.Set("foobar.com", OK, AddressList(), now); - EXPECT_FALSE(NULL == cache.Lookup("foobar.com", now)); + EXPECT_FALSE(cache.Lookup("foobar.com", now) == NULL); cache.Set("foobar.com", ERR_NAME_NOT_RESOLVED, AddressList(), now); - EXPECT_EQ(NULL, cache.Lookup("foobar.com", now)); + EXPECT_TRUE(cache.Lookup("foobar.com", now) == NULL); } TEST(HostCacheTest, Compact) { @@ -185,10 +185,10 @@ TEST(HostCacheTest, SetWithCompact) { // Adding the fourth entry will cause "expired" to be evicted. cache.Set("host3", OK, AddressList(), now); EXPECT_EQ(3U, cache.size()); - EXPECT_EQ(NULL, cache.Lookup("expired", now)); - EXPECT_FALSE(NULL == cache.Lookup("host1", now)); - EXPECT_FALSE(NULL == cache.Lookup("host2", now)); - EXPECT_FALSE(NULL == cache.Lookup("host3", now)); + EXPECT_TRUE(cache.Lookup("expired", now) == NULL); + EXPECT_FALSE(cache.Lookup("host1", now) == NULL); + EXPECT_FALSE(cache.Lookup("host2", now) == NULL); + EXPECT_FALSE(cache.Lookup("host3", now) == NULL); // Add two more entries. Something should be evicted, however "host5" // should definitely be in there (since it was last inserted). @@ -196,7 +196,7 @@ TEST(HostCacheTest, SetWithCompact) { EXPECT_EQ(3U, cache.size()); cache.Set("host5", OK, AddressList(), now); EXPECT_EQ(3U, cache.size()); - EXPECT_FALSE(NULL == cache.Lookup("host5", now)); + EXPECT_FALSE(cache.Lookup("host5", now) == NULL); } TEST(HostCacheTest, NoCache) { @@ -208,9 +208,9 @@ TEST(HostCacheTest, NoCache) { base::TimeTicks now; // Lookup and Set should have no effect. - EXPECT_EQ(NULL, cache.Lookup("foobar.com", base::TimeTicks())); + EXPECT_TRUE(cache.Lookup("foobar.com", base::TimeTicks()) == NULL); cache.Set("foobar.com", OK, AddressList(), now); - EXPECT_EQ(NULL, cache.Lookup("foobar.com", base::TimeTicks())); + EXPECT_TRUE(cache.Lookup("foobar.com", base::TimeTicks()) == NULL); EXPECT_EQ(0U, cache.size()); } diff --git a/net/base/ssl_client_auth_cache_unittest.cc b/net/base/ssl_client_auth_cache_unittest.cc index 33eb25f..85b3d5e 100644 --- a/net/base/ssl_client_auth_cache_unittest.cc +++ b/net/base/ssl_client_auth_cache_unittest.cc @@ -28,7 +28,7 @@ TEST(SSLClientAuthCacheTest, LookupAddRemove) { new X509Certificate("foo3", "CA", start_date, expiration_date)); // Lookup non-existent client certificate. - EXPECT_EQ(NULL, cache.Lookup(server1)); + EXPECT_TRUE(cache.Lookup(server1) == NULL); // Add client certificate for server1. cache.Add(server1, cert1.get()); @@ -46,12 +46,12 @@ TEST(SSLClientAuthCacheTest, LookupAddRemove) { // Remove client certificate of server1. cache.Remove(server1); - EXPECT_EQ(NULL, cache.Lookup(server1)); + EXPECT_TRUE(cache.Lookup(server1) == NULL); EXPECT_EQ(cert2.get(), cache.Lookup(server2)); // Remove non-existent client certificate. cache.Remove(server1); - EXPECT_EQ(NULL, cache.Lookup(server1)); + EXPECT_TRUE(cache.Lookup(server1) == NULL); EXPECT_EQ(cert2.get(), cache.Lookup(server2)); } diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc index 3f04d96..b23781e 100644 --- a/net/ftp/ftp_auth_cache_unittest.cc +++ b/net/ftp/ftp_auth_cache_unittest.cc @@ -17,7 +17,7 @@ TEST(FtpAuthCacheTest, LookupAddRemove) { GURL origin2("ftp://foo2"); // Lookup non-existent entry. - EXPECT_EQ(NULL, cache.Lookup(origin1)); + EXPECT_TRUE(cache.Lookup(origin1) == NULL); // Add entry for origin1. cache.Add(origin1, L"username1", L"password1"); @@ -48,11 +48,11 @@ TEST(FtpAuthCacheTest, LookupAddRemove) { // Remove entry of origin1. cache.Remove(origin1, L"username3", L"password3"); - EXPECT_EQ(NULL, cache.Lookup(origin1)); + EXPECT_TRUE(cache.Lookup(origin1) == NULL); // Remove non-existent entry. cache.Remove(origin1, L"username3", L"password3"); - EXPECT_EQ(NULL, cache.Lookup(origin1)); + EXPECT_TRUE(cache.Lookup(origin1) == NULL); } // Check that if the origin differs only by port number, it is considered @@ -95,7 +95,7 @@ TEST(FtpAuthCacheTest, NormalizedKey) { // Remove cache.Remove(GURL("ftp://HOsT"), L"othername", L"otherword"); - EXPECT_EQ(NULL, cache.Lookup(GURL("ftp://host"))); + EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL); } TEST(FtpAuthCacheTest, OnlyRemoveMatching) { @@ -110,7 +110,7 @@ TEST(FtpAuthCacheTest, OnlyRemoveMatching) { // Auth data matches, should remove. cache.Remove(GURL("ftp://host"), L"username", L"password"); - EXPECT_EQ(NULL, cache.Lookup(GURL("ftp://host"))); + EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL); } TEST(FtpAuthCacheTest, EvictOldEntries) { @@ -126,7 +126,7 @@ TEST(FtpAuthCacheTest, EvictOldEntries) { // Adding one entry should cause eviction of the first entry. cache.Add(GURL("ftp://last_host"), L"username", L"password"); - EXPECT_EQ(NULL, cache.Lookup(GURL("ftp://host0"))); + EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == NULL); // Remaining entries should not get evicted. for (size_t i = 1; i < FtpAuthCache::kMaxEntries; i++) { diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 0148a77..b80938e 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -2757,19 +2757,19 @@ TEST_F(HttpNetworkTransactionTest, ResetStateForRestart) { trans->ResetStateForRestart(); // Verify that the state that needed to be reset, has been reset. - EXPECT_EQ(NULL, trans->header_buf_->headers()); + EXPECT_TRUE(trans->header_buf_->headers() == NULL); EXPECT_EQ(0, trans->header_buf_capacity_); EXPECT_EQ(0, trans->header_buf_len_); EXPECT_EQ(-1, trans->header_buf_body_offset_); EXPECT_EQ(-1, trans->header_buf_http_offset_); EXPECT_EQ(-1, trans->response_body_length_); EXPECT_EQ(0, trans->response_body_read_); - EXPECT_EQ(NULL, trans->read_buf_.get()); + EXPECT_TRUE(trans->read_buf_.get() == NULL); EXPECT_EQ(0, trans->read_buf_len_); EXPECT_EQ("", trans->request_headers_->headers_); EXPECT_EQ(0U, trans->request_headers_bytes_sent_); - EXPECT_EQ(NULL, trans->response_.auth_challenge.get()); - EXPECT_EQ(NULL, trans->response_.headers.get()); + EXPECT_TRUE(trans->response_.auth_challenge.get() == NULL); + EXPECT_TRUE(trans->response_.headers.get() == NULL); EXPECT_EQ(false, trans->response_.was_cached); EXPECT_EQ(0, trans->response_.ssl_info.cert_status); EXPECT_FALSE(trans->response_.vary_data.is_valid()); diff --git a/net/proxy/single_threaded_proxy_resolver_unittest.cc b/net/proxy/single_threaded_proxy_resolver_unittest.cc index 7718602..7eee997 100644 --- a/net/proxy/single_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/single_threaded_proxy_resolver_unittest.cc @@ -36,8 +36,8 @@ class MockProxyResolver : public ProxyResolver { CheckIsOnWorkerThread(); - EXPECT_EQ(NULL, callback); - EXPECT_EQ(NULL, request); + EXPECT_TRUE(callback == NULL); + EXPECT_TRUE(request == NULL); // Write something into |load_log| (doesn't really have any meaning.) LoadLog::BeginEvent(load_log, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE); diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 249d7e3..5741b91 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -340,11 +340,8 @@ class TestConnectJobDelegate : public ConnectJob::Delegate { virtual void OnConnectJobComplete(int result, ConnectJob* job) { result_ = result; scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); - if (result == OK) { - EXPECT_TRUE(socket.get() != NULL); - } else { - EXPECT_EQ(NULL, socket.get()); - } + // socket.get() should be NULL iff result != OK + EXPECT_EQ(socket.get() == NULL, result != OK); delete job; have_result_ = true; if (waiting_for_result_) |