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

Unified Diff: content/child/url_loader_client_impl_unittest.cc

Issue 2629513003: Implement CachedMetadata handling on MojoAsyncResourceHandler (Closed)
Patch Set: fix Created 3 years, 11 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 | « content/child/url_loader_client_impl.cc ('k') | content/common/url_loader.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/url_loader_client_impl_unittest.cc
diff --git a/content/child/url_loader_client_impl_unittest.cc b/content/child/url_loader_client_impl_unittest.cc
index a26febf921def6b3e74bfc50695d1f19b0f27734..8b5d6ae5d04396fa3d8dc9b45e3f00b6798999a1 100644
--- a/content/child/url_loader_client_impl_unittest.cc
+++ b/content/child/url_loader_client_impl_unittest.cc
@@ -4,6 +4,7 @@
#include "content/child/url_loader_client_impl.h"
+#include <vector>
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -173,6 +174,22 @@ TEST_F(URLLoaderClientImplTest, OnDataDownloaded) {
EXPECT_EQ(14, request_peer_context_.total_encoded_data_length);
}
+TEST_F(URLLoaderClientImplTest, OnReceiveCachedMetadata) {
+ ResourceResponseHead response_head;
+ std::vector<uint8_t> metadata;
+ metadata.push_back('a');
+
+ url_loader_client_->OnReceiveResponse(response_head, nullptr);
+ url_loader_client_->OnReceiveCachedMetadata(metadata);
+
+ EXPECT_FALSE(request_peer_context_.received_response);
+ EXPECT_TRUE(request_peer_context_.cached_metadata.empty());
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(request_peer_context_.received_response);
+ ASSERT_EQ(1u, request_peer_context_.cached_metadata.size());
+ EXPECT_EQ('a', request_peer_context_.cached_metadata[0]);
+}
+
TEST_F(URLLoaderClientImplTest, OnTransferSizeUpdated) {
ResourceResponseHead response_head;
« no previous file with comments | « content/child/url_loader_client_impl.cc ('k') | content/common/url_loader.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698