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

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, 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 | « content/browser/loader/intercepting_resource_handler_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4e8e912e4b1f11fc2cb49ca0736e841a3eef6d3d..6a8bf3653aa815645c476c4c08ed47e797e400c2 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"
@@ -381,7 +382,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>(
@@ -433,7 +439,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(
@@ -594,7 +605,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 =
@@ -988,7 +1004,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>(
@@ -1036,7 +1057,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
« no previous file with comments | « content/browser/loader/intercepting_resource_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698