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

Side by Side Diff: components/autofill/content/browser/content_autofill_driver_unittest.cc

Issue 208453002: Add "previewing on hover" support for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per Ilya's comment. Created 6 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 Tuple1<base::string16> autofill_param; 158 Tuple1<base::string16> autofill_param;
159 switch (messageID) { 159 switch (messageID) {
160 case AutofillMsg_FillFieldWithValue::ID: 160 case AutofillMsg_FillFieldWithValue::ID:
161 if (!AutofillMsg_FillFieldWithValue::Read(message, &autofill_param)) 161 if (!AutofillMsg_FillFieldWithValue::Read(message, &autofill_param))
162 return false; 162 return false;
163 break; 163 break;
164 case AutofillMsg_PreviewFieldWithValue::ID: 164 case AutofillMsg_PreviewFieldWithValue::ID:
165 if (!AutofillMsg_PreviewFieldWithValue::Read(message, &autofill_param)) 165 if (!AutofillMsg_PreviewFieldWithValue::Read(message, &autofill_param))
166 return false; 166 return false;
167 break; 167 break;
168 case AutofillMsg_PreviewPassword::ID:
169 if (!AutofillMsg_PreviewPassword::Read(message, &autofill_param))
170 return false;
171 break;
168 case AutofillMsg_AcceptDataListSuggestion::ID: 172 case AutofillMsg_AcceptDataListSuggestion::ID:
169 if (!AutofillMsg_AcceptDataListSuggestion::Read(message, 173 if (!AutofillMsg_AcceptDataListSuggestion::Read(message,
170 &autofill_param)) 174 &autofill_param))
171 return false; 175 return false;
172 break; 176 break;
173 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID: 177 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID:
174 if (!AutofillMsg_AcceptPasswordAutofillSuggestion::Read( 178 if (!AutofillMsg_AcceptPasswordAutofillSuggestion::Read(
175 message, &autofill_param)) 179 message, &autofill_param))
176 return false; 180 return false;
177 break; 181 break;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 base::string16 output_value; 295 base::string16 output_value;
292 driver_->RendererShouldAcceptDataListSuggestion(input_value); 296 driver_->RendererShouldAcceptDataListSuggestion(input_value);
293 EXPECT_TRUE(GetString16FromMessageWithID( 297 EXPECT_TRUE(GetString16FromMessageWithID(
294 AutofillMsg_AcceptDataListSuggestion::ID, &output_value)); 298 AutofillMsg_AcceptDataListSuggestion::ID, &output_value));
295 EXPECT_EQ(input_value, output_value); 299 EXPECT_EQ(input_value, output_value);
296 } 300 }
297 301
298 TEST_F(ContentAutofillDriverTest, AcceptPasswordAutofillSuggestion) { 302 TEST_F(ContentAutofillDriverTest, AcceptPasswordAutofillSuggestion) {
299 base::string16 input_value(base::ASCIIToUTF16("barbaz")); 303 base::string16 input_value(base::ASCIIToUTF16("barbaz"));
300 base::string16 output_value; 304 base::string16 output_value;
301 driver_->RendererShouldAcceptPasswordAutofillSuggestion(input_value); 305 driver_->RendererShouldFillPassword(input_value);
302 EXPECT_TRUE(GetString16FromMessageWithID( 306 EXPECT_TRUE(GetString16FromMessageWithID(
303 AutofillMsg_AcceptPasswordAutofillSuggestion::ID, &output_value)); 307 AutofillMsg_AcceptPasswordAutofillSuggestion::ID, &output_value));
304 EXPECT_EQ(input_value, output_value); 308 EXPECT_EQ(input_value, output_value);
305 } 309 }
306 310
307 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) { 311 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) {
308 driver_->RendererShouldClearFilledForm(); 312 driver_->RendererShouldClearFilledForm();
309 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); 313 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID));
310 } 314 }
311 315
(...skipping 15 matching lines...) Expand all
327 TEST_F(ContentAutofillDriverTest, PreviewFieldWithValue) { 331 TEST_F(ContentAutofillDriverTest, PreviewFieldWithValue) {
328 base::string16 input_value(base::ASCIIToUTF16("barqux")); 332 base::string16 input_value(base::ASCIIToUTF16("barqux"));
329 base::string16 output_value; 333 base::string16 output_value;
330 driver_->RendererShouldPreviewFieldWithValue(input_value); 334 driver_->RendererShouldPreviewFieldWithValue(input_value);
331 EXPECT_TRUE(GetString16FromMessageWithID( 335 EXPECT_TRUE(GetString16FromMessageWithID(
332 AutofillMsg_PreviewFieldWithValue::ID, 336 AutofillMsg_PreviewFieldWithValue::ID,
333 &output_value)); 337 &output_value));
334 EXPECT_EQ(input_value, output_value); 338 EXPECT_EQ(input_value, output_value);
335 } 339 }
336 340
341 TEST_F(ContentAutofillDriverTest, PreviewPassword) {
342 base::string16 input_value(base::ASCIIToUTF16("barqux"));
343 base::string16 output_value;
344 driver_->RendererShouldPreviewPassword(input_value);
345 EXPECT_TRUE(GetString16FromMessageWithID(
346 AutofillMsg_PreviewPassword::ID, &output_value));
347 EXPECT_EQ(input_value, output_value);
348 }
349
337 } // namespace autofill 350 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698