#include "components/autofill/content/renderer/page_passwords_analyser.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "components/autofill/content/renderer/page_form_analyser_logger.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element_collection.h"
#include "third_party/blink/public/web/web_form_element.h"
namespace autofill {
namespace {
class MockPageFormAnalyserLogger : public PageFormAnalyserLogger { … };
const char kExpectedDocumentationLink[] = …;
const char kPasswordFieldNotInForm[] = …;
const char kPasswordFormWithoutUsernameField[] = …;
const char kElementsWithDuplicateIds[] = …;
const char kPasswordFormTooComplex[] = …;
const char kInferredPasswordAutocompleteAttributes[] = …
"<form>"
" <input type='text'>"
" <input type='password'>"
"</form>"
"<form>"
" <input type='text'>"
" <input type='password'>"
" <input type='password'>"
"</form>"
"<form>"
" <input type='text'>"
" <input type='password'>"
" <input type='password'>"
" <input type='password'>"
"</form>";
const char kInferredUsernameAutocompleteAttributes[] = …
"<form>"
" <input type='text'>"
" <input type='password' autocomplete='current-password'>"
"</form>"
"<form>"
" <input type='text'>"
" <input type='password' autocomplete='new-password'>"
" <input type='password' autocomplete='new-password'>"
"</form>"
"<form>"
" <input type='text'>"
" <input type='password' autocomplete='current-password'>"
" <input type='password' autocomplete='new-password'>"
" <input type='password' autocomplete='new-password'>"
"</form>";
const char kPasswordFieldsWithAndWithoutAutocomplete[] = …;
const std::string AutocompleteSuggestionString(const std::string& suggestion) { … }
}
class PagePasswordsAnalyserTest : public ChromeRenderViewTest { … };
TEST_F(PagePasswordsAnalyserTest, PasswordFieldNotInForm) { … }
TEST_F(PagePasswordsAnalyserTest, PasswordFormWithoutUsernameField) { … }
TEST_F(PagePasswordsAnalyserTest, ElementsWithDuplicateIds) { … }
TEST_F(PagePasswordsAnalyserTest, PasswordFormTooComplex) { … }
TEST_F(PagePasswordsAnalyserTest, InferredPasswordAutocompleteAttributes) { … }
TEST_F(PagePasswordsAnalyserTest, InferredUsernameAutocompleteAttributes) { … }
TEST_F(PagePasswordsAnalyserTest, PasswordFieldWithAndWithoutAutocomplete) { … }
}