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

Side by Side Diff: components/autofill/content/renderer/form_cache_unittest.cc

Issue 1411363003: [Autofill] Always show available data when encountering autocomplete attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #include "components/autofill/content/renderer/form_cache.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_test_utils.h"
9 #include "components/autofill/core/common/form_data.h"
10 #include "components/autofill/core/common/form_field_data.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12
13 namespace autofill {
14
15 TEST(FormCacheTest, IsFormInteresting) {
16 FormData form;
17 form.name = base::ASCIIToUTF16("TestForm");
18 form.origin = GURL("http://example.com/form.html");
19 form.action = GURL("http://example.com/submit.html");
20
21 // No fields.
22 EXPECT_FALSE(FormCache::IsFormInteresting(form));
23
24 // One field without an autocomplete attribute.
25 FormFieldData field;
26 test::CreateTestFormField("Name", "name", "", "text", &field);
27 form.fields.push_back(field);
28 EXPECT_FALSE(FormCache::IsFormInteresting(form));
29
30 // One field with an autocomplete attribute.
31 form.fields[0].autocomplete_attribute = "given-name";
32 EXPECT_TRUE(FormCache::IsFormInteresting(form));
33
34 // Three fields with no autocomplete attributes.
35 form.fields[0].autocomplete_attribute = "";
36 test::CreateTestFormField("Country", "country", "", "text", &field);
37 form.fields.push_back(field);
38 test::CreateTestFormField("Email", "email", "", "text", &field);
39 form.fields.push_back(field);
40 EXPECT_TRUE(FormCache::IsFormInteresting(form));
41 }
42
43 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698