Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / password_manager / password_form_data.h
blob0421a7d21ac3589a57ff8184763c8e27b854e9e6
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_DATA_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_DATA_H_
8 #include <ostream>
10 #include "components/autofill/core/common/password_form.h"
11 #include "testing/gmock/include/gmock/gmock.h"
13 // TODO(sync): This file must eventually be refactored away -- crbug.com/87185.
15 // Struct used for creation of PasswordForms from static arrays of data.
16 // Note: This is only meant to be used in unit test.
17 struct PasswordFormData {
18 const autofill::PasswordForm::Scheme scheme;
19 const char* signon_realm;
20 const char* origin;
21 const char* action;
22 const wchar_t* submit_element;
23 const wchar_t* username_element;
24 const wchar_t* password_element;
25 const wchar_t* username_value; // Set to NULL for a blacklist entry.
26 const wchar_t* password_value;
27 const bool preferred;
28 const bool ssl_valid;
29 const double creation_time;
32 // Creates and returns a new PasswordForm built from form_data. Caller is
33 // responsible for deleting the object when finished with it.
34 autofill::PasswordForm* CreatePasswordFormFromData(
35 const PasswordFormData& form_data);
37 // Checks whether two vectors of PasswordForms contain equivalent elements,
38 // regardless of order.
39 bool ContainsSamePasswordFormsPtr(
40 const std::vector<autofill::PasswordForm*>& first,
41 const std::vector<autofill::PasswordForm*>& second);
43 bool ContainsSamePasswordForms(
44 std::vector<autofill::PasswordForm>& first,
45 std::vector<autofill::PasswordForm>& second);
47 // This gmock matcher is used to check that the |arg| contains exactly the same
48 // PasswordForms as |forms|, regardless of order.
49 MATCHER_P(ContainsAllPasswordForms, forms, "") {
50 return ContainsSamePasswordFormsPtr(forms, arg);
53 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_DATA_H_