OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The PasswordManagerAutocompleteTests in this file test only the | 5 // The PasswordManagerAutocompleteTests in this file test only the |
6 // PasswordAutocompleteListener class implementation (and not any of the | 6 // PasswordAutocompleteListener class implementation (and not any of the |
7 // higher level dom autocomplete framework). | 7 // higher level dom autocomplete framework). |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include "config.h" | 10 #include "config.h" |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 | 13 |
14 MSVC_PUSH_WARNING_LEVEL(0); | 14 MSVC_PUSH_WARNING_LEVEL(0); |
15 #include "HTMLInputElement.h" | 15 #include "HTMLInputElement.h" |
16 #include "HTMLFormElement.h" | 16 #include "HTMLFormElement.h" |
17 #include "Document.h" | 17 #include "Document.h" |
18 #include "Frame.h" | 18 #include "Frame.h" |
19 #include "Editor.h" | 19 #include "Editor.h" |
20 #include "EventNames.h" | 20 #include "EventNames.h" |
21 #include "Event.h" | 21 #include "Event.h" |
22 #include "EventListener.h" | 22 #include "EventListener.h" |
23 MSVC_POP_WARNING(); | 23 MSVC_POP_WARNING(); |
24 | 24 |
25 #undef LOG | 25 #undef LOG |
26 | 26 |
27 #include "webkit/glue/autocomplete_input_listener.h" | |
28 #include "webkit/glue/password_autocomplete_listener.h" | 27 #include "webkit/glue/password_autocomplete_listener.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
30 | 29 |
31 using webkit_glue::AutocompleteInputListener; | |
32 using webkit_glue::PasswordAutocompleteListener; | 30 using webkit_glue::PasswordAutocompleteListener; |
33 using webkit_glue::HTMLInputDelegate; | 31 using webkit_glue::HTMLInputDelegate; |
34 | 32 |
35 class TestHTMLInputDelegate : public HTMLInputDelegate { | 33 class TestHTMLInputDelegate : public HTMLInputDelegate { |
36 public: | 34 public: |
37 TestHTMLInputDelegate() : HTMLInputDelegate(NULL), | 35 TestHTMLInputDelegate() : HTMLInputDelegate(NULL), |
38 did_call_on_finish_(false), | 36 did_call_on_finish_(false), |
39 did_set_value_(false), | 37 did_set_value_(false), |
40 did_set_selection_(false), | 38 did_set_selection_(false), |
41 selection_start_(0), | 39 selection_start_(0), |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_EQ(empty, password_delegate->value()); | 235 EXPECT_EQ(empty, password_delegate->value()); |
238 listener->OnBlur(NULL, L"ali"); | 236 listener->OnBlur(NULL, L"ali"); |
239 EXPECT_EQ(empty, username_delegate->value()); | 237 EXPECT_EQ(empty, username_delegate->value()); |
240 EXPECT_EQ(empty, password_delegate->value()); | 238 EXPECT_EQ(empty, password_delegate->value()); |
241 | 239 |
242 // Blur with 'alice' should allow password autofill. | 240 // Blur with 'alice' should allow password autofill. |
243 listener->OnBlur(NULL, L"alice"); | 241 listener->OnBlur(NULL, L"alice"); |
244 EXPECT_EQ(empty, username_delegate->value()); | 242 EXPECT_EQ(empty, username_delegate->value()); |
245 EXPECT_EQ(password1_, password_delegate->value()); | 243 EXPECT_EQ(password1_, password_delegate->value()); |
246 } | 244 } |
OLD | NEW |