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

Unified Diff: content/browser/loader/mime_sniffing_resource_handler_unittest.cc

Issue 2327463002: Relax ad-hoc assumptions on InterceptingResourceHandler (Closed)
Patch Set: fix Created 4 years, 3 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: content/browser/loader/mime_sniffing_resource_handler_unittest.cc
diff --git a/content/browser/loader/mime_sniffing_resource_handler_unittest.cc b/content/browser/loader/mime_sniffing_resource_handler_unittest.cc
index ed407eb1d68106b55ac9160c73f8f61f9bc26413..4a75e88e7dfaf124b69f3374052ef7bdab841502 100644
--- a/content/browser/loader/mime_sniffing_resource_handler_unittest.cc
+++ b/content/browser/loader/mime_sniffing_resource_handler_unittest.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/loader/intercepting_resource_handler.h"
@@ -379,7 +380,12 @@ bool MimeSniffingResourceHandlerTest::TestStreamIsIntercepted(
TestFakePluginService plugin_service(plugin_available_, plugin_stale_);
std::unique_ptr<InterceptingResourceHandler> intercepting_handler(
- new InterceptingResourceHandler(std::unique_ptr<ResourceHandler>(),
+ new InterceptingResourceHandler(base::MakeUnique<TestResourceHandler>(
+ true, // response_started_succeeds
+ false, // defer_response_started
+ true, // will_read_succeeds,
+ true, // read_completed_succeeds,
+ false), // defer_read_completed
nullptr));
std::unique_ptr<ResourceHandler> mime_handler(new MimeSniffingResourceHandler(
std::unique_ptr<ResourceHandler>(
@@ -431,7 +437,12 @@ void MimeSniffingResourceHandlerTest::TestHandlerSniffing(
TestFakePluginService plugin_service(plugin_available_, plugin_stale_);
std::unique_ptr<InterceptingResourceHandler> intercepting_handler(
- new InterceptingResourceHandler(std::unique_ptr<ResourceHandler>(),
+ new InterceptingResourceHandler(base::MakeUnique<TestResourceHandler>(
+ true, // response_started_succeeds
+ false, // defer_on_response_started
+ true, // will_read_succeeds
+ true, // read_completed_succeeds
+ false), // defer_on_read_completed
nullptr));
std::unique_ptr<TestResourceHandler> scoped_test_handler =
std::unique_ptr<TestResourceHandler>(new TestResourceHandler(
@@ -592,7 +603,12 @@ void MimeSniffingResourceHandlerTest::TestHandlerNoSniffing(
TestFakePluginService plugin_service(plugin_available_, plugin_stale_);
std::unique_ptr<InterceptingResourceHandler> intercepting_handler(
- new InterceptingResourceHandler(std::unique_ptr<ResourceHandler>(),
+ new InterceptingResourceHandler(base::MakeUnique<TestResourceHandler>(
+ true, // response_started_succeeds
+ false, // defer_response_started
+ true, // will_read_succeeds,
+ true, // read_completed_succeeds,
+ false), // defer_read_completed
nullptr));
std::unique_ptr<TestResourceHandler> scoped_test_handler =
@@ -986,7 +1002,12 @@ TEST_F(MimeSniffingResourceHandlerTest, 304Handling) {
TestFakePluginService plugin_service(false, false);
std::unique_ptr<ResourceHandler> intercepting_handler(
- new InterceptingResourceHandler(std::unique_ptr<ResourceHandler>(),
+ new InterceptingResourceHandler(base::MakeUnique<TestResourceHandler>(
+ true, // response_started_succeeds
+ false, // defer_response_started
+ true, // will_read_succeeds,
+ true, // read_completed_succeeds,
+ false), // defer_read_completed
nullptr));
std::unique_ptr<ResourceHandler> mime_handler(new MimeSniffingResourceHandler(
std::unique_ptr<ResourceHandler>(
@@ -1034,7 +1055,13 @@ TEST_F(MimeSniffingResourceHandlerTest, FetchShouldDisableMimeSniffing) {
TestFakePluginService plugin_service(false, false);
std::unique_ptr<InterceptingResourceHandler> intercepting_handler(
- new InterceptingResourceHandler(nullptr, nullptr));
+ new InterceptingResourceHandler(base::MakeUnique<TestResourceHandler>(
+ true, // response_started_succeeds
+ false, // defer_response_started
+ true, // will_read_succeeds,
+ true, // read_completed_succeeds,
+ false), // defer_read_completed
+ nullptr));
std::unique_ptr<TestResourceHandler> scoped_test_handler(
new TestResourceHandler(false, // response_started

Powered by Google App Engine
This is Rietveld 408576698