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

Side by Side Diff: chrome/renderer/autofill/password_generation_manager_browsertest.cc

Issue 10222017: Make password generation switched by a preference in chrome settings rather than a command line fla… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make password generation checkbox hidden by the command flag. Created 8 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/common/autofill_messages.h" 8 #include "chrome/common/autofill_messages.h"
9 #include "chrome/renderer/autofill/password_generation_manager.h" 9 #include "chrome/renderer/autofill/password_generation_manager.h"
10 #include "chrome/test/base/chrome_render_view_test.h" 10 #include "chrome/test/base/chrome_render_view_test.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ASSERT_FALSE(element.isNull()); 105 ASSERT_FALSE(element.isNull());
106 WebInputElement first_password_element = element.to<WebInputElement>(); 106 WebInputElement first_password_element = element.to<WebInputElement>();
107 EXPECT_EQ(0u, generation_manager_->messages().size()); 107 EXPECT_EQ(0u, generation_manager_->messages().size());
108 element = document.getElementById(WebString::fromUTF8("second_password")); 108 element = document.getElementById(WebString::fromUTF8("second_password"));
109 ASSERT_FALSE(element.isNull()); 109 ASSERT_FALSE(element.isNull());
110 WebInputElement second_password_element = element.to<WebInputElement>(); 110 WebInputElement second_password_element = element.to<WebInputElement>();
111 EXPECT_EQ(0u, generation_manager_->messages().size()); 111 EXPECT_EQ(0u, generation_manager_->messages().size());
112 SetFocused(first_password_element.to<WebNode>()); 112 SetFocused(first_password_element.to<WebNode>());
113 EXPECT_EQ(0u, generation_manager_->messages().size()); 113 EXPECT_EQ(0u, generation_manager_->messages().size());
114 114
115 // Pretend like sync was enabled. 115 // Pretend like password generation was enabled.
116 AutofillMsg_PasswordGenerationEnabled msg(0, true); 116 AutofillMsg_PasswordGenerationEnabled msg(0, true);
117 generation_manager_->OnMessageReceived(msg); 117 generation_manager_->OnMessageReceived(msg);
118 118
119 // Now we will send a message once the first password feld is focused. 119 // Now we will send a message once the first password feld is focused.
120 LoadHTML(kAccountCreationFormHTML); 120 LoadHTML(kAccountCreationFormHTML);
121 document = GetMainFrame()->document(); 121 document = GetMainFrame()->document();
122 element = document.getElementById(WebString::fromUTF8("first_password")); 122 element = document.getElementById(WebString::fromUTF8("first_password"));
123 ASSERT_FALSE(element.isNull()); 123 ASSERT_FALSE(element.isNull());
124 first_password_element = element.to<WebInputElement>(); 124 first_password_element = element.to<WebInputElement>();
125 EXPECT_EQ(0u, generation_manager_->messages().size()); 125 EXPECT_EQ(0u, generation_manager_->messages().size());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 generation_manager_->OnMessageReceived(msg); 157 generation_manager_->OnMessageReceived(msg);
158 158
159 // Password fields are filled out and set as being autofilled. 159 // Password fields are filled out and set as being autofilled.
160 EXPECT_EQ(password, first_password_element.value()); 160 EXPECT_EQ(password, first_password_element.value());
161 EXPECT_EQ(password, second_password_element.value()); 161 EXPECT_EQ(password, second_password_element.value());
162 EXPECT_TRUE(first_password_element.isAutofilled()); 162 EXPECT_TRUE(first_password_element.isAutofilled());
163 EXPECT_TRUE(second_password_element.isAutofilled()); 163 EXPECT_TRUE(second_password_element.isAutofilled());
164 } 164 }
165 165
166 } // namespace autofill 166 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698