Commit 92499bf1 authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Refactor signed_exchange_subresource_prefetch_browsertest.cc

Bug: 935267
Change-Id: I8800a415c1fffd0e59d37f1a65d122d17ab5e6c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1641017Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666161}
parent de3078d5
...@@ -30,8 +30,14 @@ PrefetchBrowserTestBase::ResponseEntry::ResponseEntry( ...@@ -30,8 +30,14 @@ PrefetchBrowserTestBase::ResponseEntry::ResponseEntry(
const std::vector<std::pair<std::string, std::string>>& headers) const std::vector<std::pair<std::string, std::string>>& headers)
: content(content), content_type(content_type), headers(headers) {} : content(content), content_type(content_type), headers(headers) {}
PrefetchBrowserTestBase::ResponseEntry::ResponseEntry(ResponseEntry&& other) =
default;
PrefetchBrowserTestBase::ResponseEntry::~ResponseEntry() = default; PrefetchBrowserTestBase::ResponseEntry::~ResponseEntry() = default;
PrefetchBrowserTestBase::ResponseEntry& PrefetchBrowserTestBase::ResponseEntry::
operator=(ResponseEntry&& other) = default;
PrefetchBrowserTestBase::ScopedSignedExchangeHandlerFactory:: PrefetchBrowserTestBase::ScopedSignedExchangeHandlerFactory::
ScopedSignedExchangeHandlerFactory(SignedExchangeHandlerFactory* factory) { ScopedSignedExchangeHandlerFactory(SignedExchangeHandlerFactory* factory) {
SignedExchangeLoader::SetSignedExchangeHandlerFactoryForTest(factory); SignedExchangeLoader::SetSignedExchangeHandlerFactoryForTest(factory);
...@@ -61,8 +67,8 @@ void PrefetchBrowserTestBase::SetUpOnMainThread() { ...@@ -61,8 +67,8 @@ void PrefetchBrowserTestBase::SetUpOnMainThread() {
} }
void PrefetchBrowserTestBase::RegisterResponse(const std::string& url, void PrefetchBrowserTestBase::RegisterResponse(const std::string& url,
const ResponseEntry& entry) { ResponseEntry&& entry) {
response_map_[url] = entry; response_map_[url] = std::move(entry);
} }
std::unique_ptr<net::test_server::HttpResponse> std::unique_ptr<net::test_server::HttpResponse>
......
...@@ -29,10 +29,14 @@ class PrefetchBrowserTestBase : public ContentBrowserTest { ...@@ -29,10 +29,14 @@ class PrefetchBrowserTestBase : public ContentBrowserTest {
public: public:
struct ResponseEntry { struct ResponseEntry {
ResponseEntry(); ResponseEntry();
explicit ResponseEntry( ResponseEntry(
const std::string& content, const std::string& content,
const std::string& content_types = "text/html", const std::string& content_types = "text/html",
const std::vector<std::pair<std::string, std::string>>& headers = {}); const std::vector<std::pair<std::string, std::string>>& headers = {});
ResponseEntry(const ResponseEntry&) = delete;
ResponseEntry(ResponseEntry&& other);
ResponseEntry& operator=(const ResponseEntry&) = delete;
ResponseEntry& operator=(ResponseEntry&&);
~ResponseEntry(); ~ResponseEntry();
std::string content; std::string content;
...@@ -52,7 +56,7 @@ class PrefetchBrowserTestBase : public ContentBrowserTest { ...@@ -52,7 +56,7 @@ class PrefetchBrowserTestBase : public ContentBrowserTest {
void SetUpOnMainThread() override; void SetUpOnMainThread() override;
protected: protected:
void RegisterResponse(const std::string& url, const ResponseEntry& entry); void RegisterResponse(const std::string& url, ResponseEntry&& entry);
std::unique_ptr<net::test_server::HttpResponse> ServeResponses( std::unique_ptr<net::test_server::HttpResponse> ServeResponses(
const net::test_server::HttpRequest& request); const net::test_server::HttpRequest& request);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment