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

Unified Diff: components/autofill/core/browser/form_structure_unittest.cc

Issue 2318533002: [Password Generation] Use signatures for form matching (Closed)
Patch Set: Rebase 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
« no previous file with comments | « components/autofill/core/browser/form_structure.cc ('k') | components/autofill/core/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/form_structure_unittest.cc
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc
index 8d7f64730c075bcdc5b9a94100f1702c240e4abe..bd5194624b958dd6506137864407ccca0aa4833a 100644
--- a/components/autofill/core/browser/form_structure_unittest.cc
+++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -17,6 +17,7 @@
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
+#include "components/autofill/core/common/signatures_util.h"
#include "components/variations/entropy_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -50,7 +51,7 @@ std::ostream& operator<<(std::ostream& os, const FormData& form) {
class FormStructureTest : public testing::Test {
public:
static std::string Hash64Bit(const std::string& str) {
- return base::Uint64ToString(FormStructure::Hash64Bit(str));
+ return base::Uint64ToString(StrToHash64Bit(str));
}
void SetUp() override {
@@ -3308,27 +3309,26 @@ TEST_F(FormStructureTest, CheckFormSignature) {
form_structure.reset(new FormStructure(form));
- EXPECT_EQ(FormStructureTest::Hash64Bit(
- std::string("://&&email&first")),
- form_structure->FormSignature());
+ EXPECT_EQ(FormStructureTest::Hash64Bit(std::string("://&&email&first")),
+ form_structure->FormSignatureAsStr());
form.origin = GURL(std::string("http://www.facebook.com"));
form_structure.reset(new FormStructure(form));
EXPECT_EQ(FormStructureTest::Hash64Bit(
- std::string("http://www.facebook.com&&email&first")),
- form_structure->FormSignature());
+ std::string("http://www.facebook.com&&email&first")),
+ form_structure->FormSignatureAsStr());
form.action = GURL(std::string("https://login.facebook.com/path"));
form_structure.reset(new FormStructure(form));
EXPECT_EQ(FormStructureTest::Hash64Bit(
- std::string("https://login.facebook.com&&email&first")),
- form_structure->FormSignature());
+ std::string("https://login.facebook.com&&email&first")),
+ form_structure->FormSignatureAsStr());
form.name = ASCIIToUTF16("login_form");
form_structure.reset(new FormStructure(form));
- EXPECT_EQ(FormStructureTest::Hash64Bit(
- std::string("https://login.facebook.com&login_form&email&first")),
- form_structure->FormSignature());
+ EXPECT_EQ(FormStructureTest::Hash64Bit(std::string(
+ "https://login.facebook.com&login_form&email&first")),
+ form_structure->FormSignatureAsStr());
field.check_status = FormFieldData::NOT_CHECKABLE;
field.label = ASCIIToUTF16("Random Field label");
@@ -3346,9 +3346,9 @@ TEST_F(FormStructureTest, CheckFormSignature) {
form.fields.push_back(field);
form_structure.reset(new FormStructure(form));
EXPECT_EQ(FormStructureTest::Hash64Bit(
- std::string("https://login.facebook.com&login_form&email&first&"
- "random1234&random&1random&random")),
- form_structure->FormSignature());
+ std::string("https://login.facebook.com&login_form&email&first&"
+ "random1234&random&1random&random")),
+ form_structure->FormSignatureAsStr());
}
TEST_F(FormStructureTest, ToFormData) {
« no previous file with comments | « components/autofill/core/browser/form_structure.cc ('k') | components/autofill/core/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698