summaryrefslogtreecommitdiff
path: root/chromium/components/autofill/core/browser/test_form_structure.cc
blob: 63e0933ad271a7c586f2fbd325cfd8205316038b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/test_form_structure.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace autofill {

TestFormStructure::TestFormStructure(const FormData& form)
    : FormStructure(form) {}

TestFormStructure::~TestFormStructure() {}

void TestFormStructure::SetFieldTypes(
    const std::vector<ServerFieldType>& heuristic_types,
    const std::vector<ServerFieldType>& server_types) {
  ASSERT_EQ(field_count(), heuristic_types.size());
  ASSERT_EQ(field_count(), server_types.size());

  for (size_t i = 0; i < field_count(); ++i) {
    AutofillField* form_field = field(i);
    ASSERT_TRUE(form_field);
    form_field->set_heuristic_type(heuristic_types[i]);
    form_field->set_server_type(server_types[i]);
  }

  UpdateAutofillCount();
}

}  // namespace autofill