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

Unified Diff: chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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: chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
diff --git a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
index 2fc28d3d3455a4633e06b9d9bcd689cb4027552a..464e975c0dfd7a07a26c4b874a9a9e929107e174 100644
--- a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
+++ b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -25,13 +25,13 @@ namespace extensions {
namespace {
-scoped_ptr<net::test_server::HttpResponse> HandleRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleRequest(
bool set_cache_header_redirect_page,
bool set_cache_header_test_throttle_page,
const net::test_server::HttpRequest& request) {
if (base::StartsWith(request.relative_url, "/redirect",
base::CompareCase::SENSITIVE)) {
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse());
http_response->set_code(net::HTTP_FOUND);
http_response->set_content("Redirecting...");
@@ -44,7 +44,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequest(
if (base::StartsWith(request.relative_url, "/test_throttle",
base::CompareCase::SENSITIVE)) {
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse());
http_response->set_code(net::HTTP_SERVICE_UNAVAILABLE);
http_response->set_content("The server is overloaded right now.");
@@ -55,7 +55,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequest(
}
// Unhandled requests result in the Embedded test server sending a 404.
- return scoped_ptr<net::test_server::BasicHttpResponse>();
+ return std::unique_ptr<net::test_server::BasicHttpResponse>();
}
} // namespace
@@ -75,32 +75,34 @@ class ExtensionRequestLimitingThrottleBrowserTest
// checking of the net::LOAD_MAYBE_USER_GESTURE load flag in the manager
// in order to test the throttling logic.
manager->SetIgnoreUserGestureLoadFlagForTests(true);
- scoped_ptr<
- net::BackoffEntry::Policy> policy(new net::BackoffEntry::Policy{
- // Number of initial errors (in sequence) to ignore before applying
- // exponential back-off rules.
- 1,
-
- // Initial delay for exponential back-off in ms.
- 10 * 60 * 1000,
-
- // Factor by which the waiting time will be multiplied.
- 10,
-
- // Fuzzing percentage. ex: 10% will spread requests randomly
- // between 90%-100% of the calculated time.
- 0.1,
-
- // Maximum amount of time we are willing to delay our request in ms.
- 15 * 60 * 1000,
-
- // Time to keep an entry from being discarded even when it
- // has no significant state, -1 to never discard.
- -1,
-
- // Don't use initial delay unless the last request was an error.
- false,
- });
+ std::unique_ptr<net::BackoffEntry::Policy> policy(
+ new net::BackoffEntry::Policy{
+ // Number of initial errors (in sequence) to ignore before
+ // applying
+ // exponential back-off rules.
+ 1,
+
+ // Initial delay for exponential back-off in ms.
+ 10 * 60 * 1000,
+
+ // Factor by which the waiting time will be multiplied.
+ 10,
+
+ // Fuzzing percentage. ex: 10% will spread requests randomly
+ // between 90%-100% of the calculated time.
+ 0.1,
+
+ // Maximum amount of time we are willing to delay our request in
+ // ms.
+ 15 * 60 * 1000,
+
+ // Time to keep an entry from being discarded even when it
+ // has no significant state, -1 to never discard.
+ -1,
+
+ // Don't use initial delay unless the last request was an error.
+ false,
+ });
manager->SetBackoffPolicyForTests(std::move(policy));
}
// Requests to 127.0.0.1 bypass throttling, so set up a host resolver rule
« no previous file with comments | « chrome/browser/extensions/extension_reenabler_unittest.cc ('k') | chrome/browser/extensions/extension_resource_protocols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698