OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/macros.h" | 5 #include "base/macros.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/test/base/chrome_render_view_test.h" | 7 #include "chrome/test/base/chrome_render_view_test.h" |
8 #include "components/autofill/content/renderer/form_classifier.h" | 8 #include "components/autofill/content/renderer/form_classifier.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/WebKit/public/web/WebDocument.h" | 10 #include "third_party/WebKit/public/web/WebDocument.h" |
11 #include "third_party/WebKit/public/web/WebFormElement.h" | 11 #include "third_party/WebKit/public/web/WebFormElement.h" |
12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 13 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 14 #include "ui/native_theme/native_theme_switches.h" |
13 | 15 |
14 namespace autofill { | 16 namespace autofill { |
15 | 17 |
16 class FormClassifierTest : public ChromeRenderViewTest { | 18 class FormClassifierTest : public ChromeRenderViewTest { |
17 public: | 19 public: |
18 FormClassifierTest() {} | 20 FormClassifierTest() {} |
19 | 21 |
| 22 void SetUp() override { |
| 23 blink::WebRuntimeFeatures::enableOverlayScrollbars( |
| 24 ui::IsOverlayScrollbarEnabled()); |
| 25 ChromeRenderViewTest::SetUp(); |
| 26 } |
| 27 |
20 void TearDown() override { | 28 void TearDown() override { |
21 LoadHTML(""); | 29 LoadHTML(""); |
22 ChromeRenderViewTest::TearDown(); | 30 ChromeRenderViewTest::TearDown(); |
23 } | 31 } |
24 | 32 |
25 bool GetGenerationField(std::string* generation_field) { | 33 bool GetGenerationField(std::string* generation_field) { |
26 blink::WebDocument document = GetMainFrame()->document(); | 34 blink::WebDocument document = GetMainFrame()->document(); |
27 blink::WebFormElement form = | 35 blink::WebFormElement form = |
28 document.getElementById("test_form").to<blink::WebFormElement>(); | 36 document.getElementById("test_form").to<blink::WebFormElement>(); |
29 base::string16 generation_field16; | 37 base::string16 generation_field16; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 235 } |
228 | 236 |
229 TEST_F(FormClassifierTest, kChangeFormWithTreePasswordFieldsHTML) { | 237 TEST_F(FormClassifierTest, kChangeFormWithTreePasswordFieldsHTML) { |
230 LoadHTML(kChangeFormWithTreePasswordFieldsHTML); | 238 LoadHTML(kChangeFormWithTreePasswordFieldsHTML); |
231 std::string generation_field; | 239 std::string generation_field; |
232 EXPECT_TRUE(GetGenerationField(&generation_field)); | 240 EXPECT_TRUE(GetGenerationField(&generation_field)); |
233 EXPECT_EQ("password", generation_field); | 241 EXPECT_EQ("password", generation_field); |
234 } | 242 } |
235 | 243 |
236 } // namespace autofill | 244 } // namespace autofill |
OLD | NEW |