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

Unified Diff: components/password_manager/core/browser/password_manager_test_utils.cc

Issue 2714543006: Clean Obsolete HTTP Data from the Password Store (Closed)
Patch Set: Raw Cleaner Created 3 years, 9 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: components/password_manager/core/browser/password_manager_test_utils.cc
diff --git a/components/password_manager/core/browser/password_manager_test_utils.cc b/components/password_manager/core/browser/password_manager_test_utils.cc
index 4fd519336427568ab725a215770a453dd01a10b9..85e5b403f143fc459c9c649020dfa7ac27491d2a 100644
--- a/components/password_manager/core/browser/password_manager_test_utils.cc
+++ b/components/password_manager/core/browser/password_manager_test_utils.cc
@@ -11,6 +11,7 @@
#include "base/feature_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/time/time.h"
using autofill::PasswordForm;
@@ -59,6 +60,17 @@ std::unique_ptr<PasswordForm> CreatePasswordFormFromDataForTesting(
return form;
}
+std::vector<std::unique_ptr<PasswordForm>> WrapForms(
+ std::vector<PasswordForm> forms) {
+ std::vector<std::unique_ptr<PasswordForm>> results;
+ results.reserve(forms.size());
+ std::transform(forms.begin(), forms.end(), std::back_inserter(results),
+ [](PasswordForm& form) {
+ return base::MakeUnique<PasswordForm>(std::move(form));
+ });
+ return results;
+}
+
bool ContainsEqualPasswordFormsUnordered(
const std::vector<std::unique_ptr<PasswordForm>>& expectations,
const std::vector<std::unique_ptr<PasswordForm>>& actual_values,
@@ -108,4 +120,19 @@ MockPasswordReuseDetectorConsumer::MockPasswordReuseDetectorConsumer() {}
MockPasswordReuseDetectorConsumer::~MockPasswordReuseDetectorConsumer() {}
+HSTSStateManager::HSTSStateManager(net::TransportSecurityState* state,
+ bool is_hsts,
+ const std::string& host)
+ : state_(state), is_hsts_(is_hsts), host_(host) {
+ if (is_hsts_) {
+ base::Time expiry = base::Time::Max();
+ bool include_subdomains = false;
+ state_->AddHSTS(host_, expiry, include_subdomains);
+ }
+}
+
+HSTSStateManager::~HSTSStateManager() {
+ if (is_hsts_)
+ state_->DeleteDynamicDataForHost(host_);
+}
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698