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

Unified Diff: net/http/http_cache_unittest.cc

Issue 16480002: Fix some potential after free errors on TestCompletionCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another one Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 3b41de6b6bf0ab9e66dcade64728157985e680cf..03fae9fd4a14d84542b474f00cc2c8db87c94665 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -5932,20 +5932,25 @@ TEST(HttpCache, SetPriority) {
net::HttpRequestInfo info;
info.url = GURL(kSimpleGET_Transaction.url);
net::TestCompletionCallback callback;
- EXPECT_EQ(net::ERR_IO_PENDING,
+ ASSERT_EQ(net::ERR_IO_PENDING,
rvargas (doing something else) 2013/06/06 18:55:48 Why does this matter? (where does it hangs?). I'm
gavinp 2013/06/26 00:07:42 You're right, it's not. I misunderstood TestComple
trans->Start(&info, callback.callback(), net::BoundNetLog()));
- ASSERT_TRUE(cache.network_layer()->last_transaction().get());
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_create_transaction_priority());
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_transaction()->priority());
+ EXPECT_TRUE(cache.network_layer()->last_transaction());
+ if (cache.network_layer()->last_transaction()) {
+ EXPECT_EQ(net::LOW,
+ cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(net::LOW,
+ cache.network_layer()->last_transaction()->priority());
+ }
trans->SetPriority(net::HIGHEST);
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_create_transaction_priority());
- EXPECT_EQ(net::HIGHEST,
- cache.network_layer()->last_transaction()->priority());
+
+ if (cache.network_layer()->last_transaction()) {
+ EXPECT_EQ(net::LOW,
+ cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(net::HIGHEST,
+ cache.network_layer()->last_transaction()->priority());
+ }
EXPECT_EQ(net::OK, callback.WaitForResult());
}
« no previous file with comments | « net/cert/multi_threaded_cert_verifier_unittest.cc ('k') | net/http/http_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698