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

Unified Diff: net/http/disk_cache_based_quic_server_info_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.cc ('k') | net/http/http_auth_gssapi_posix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_cache_based_quic_server_info_unittest.cc
diff --git a/net/http/disk_cache_based_quic_server_info_unittest.cc b/net/http/disk_cache_based_quic_server_info_unittest.cc
index 9bd7462bdf60305b9910cc741189bd18f2345816..845fdc953f64ca34f7ecff583e6eeaf4c772644f 100644
--- a/net/http/disk_cache_based_quic_server_info_unittest.cc
+++ b/net/http/disk_cache_based_quic_server_info_unittest.cc
@@ -359,4 +359,40 @@ TEST(DiskCacheBasedQuicServerInfo, MultiplePersist) {
RemoveMockTransaction(&kHostInfoTransaction1);
}
+TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReady) {
+ MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
+ MockHttpCache cache(factory);
+ TestCompletionCallback callback;
+ QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED);
+ scoped_ptr<QuicServerInfo> quic_server_info(
+ new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
+ EXPECT_FALSE(quic_server_info->IsDataReady());
+ quic_server_info->Start();
+ int rv = quic_server_info->WaitForDataReady(callback.callback());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
+ // Now cancel the callback.
+ quic_server_info->CancelWaitForDataReadyCallback();
+ EXPECT_FALSE(quic_server_info->IsDataReady());
+ // Now complete the backend creation and let the callback run.
+ factory->FinishCreation();
+ EXPECT_TRUE(quic_server_info->IsDataReady());
+}
+
+TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyButDataIsReady) {
+ MockHttpCache cache;
+ AddMockTransaction(&kHostInfoTransaction1);
+ TestCompletionCallback callback;
+
+ QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED);
+ scoped_ptr<QuicServerInfo> quic_server_info(
+ new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
+ EXPECT_FALSE(quic_server_info->IsDataReady());
+ quic_server_info->Start();
+ int rv = quic_server_info->WaitForDataReady(callback.callback());
+ quic_server_info->CancelWaitForDataReadyCallback();
+ EXPECT_EQ(OK, callback.GetResult(rv));
+ EXPECT_TRUE(quic_server_info->IsDataReady());
+ RemoveMockTransaction(&kHostInfoTransaction1);
+}
+
} // namespace net
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.cc ('k') | net/http/http_auth_gssapi_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698