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

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

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error on Chrome OS. Created 6 years, 8 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 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_AcceptDataListSuggestion::ID: 168 case AutofillMsg_AcceptDataListSuggestion::ID:
169 if (!AutofillMsg_AcceptDataListSuggestion::Read(message, 169 if (!AutofillMsg_AcceptDataListSuggestion::Read(message,
170 &autofill_param)) 170 &autofill_param))
171 return false; 171 return false;
172 break; 172 break;
173 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID:
174 if (!AutofillMsg_AcceptPasswordAutofillSuggestion::Read(
175 message, &autofill_param))
176 return false;
177 break;
178 default: 173 default:
179 NOTREACHED(); 174 NOTREACHED();
180 } 175 }
181 if (value) 176 if (value)
182 *value = autofill_param.a; 177 *value = autofill_param.a;
183 process()->sink().ClearMessages(); 178 process()->sink().ClearMessages();
184 return true; 179 return true;
185 } 180 }
186 181
187 // Searches for a message matching |messageID| in the queue of sent IPC 182 // Searches for a message matching |messageID| in the queue of sent IPC
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 283
289 TEST_F(ContentAutofillDriverTest, AcceptDataListSuggestion) { 284 TEST_F(ContentAutofillDriverTest, AcceptDataListSuggestion) {
290 base::string16 input_value(base::ASCIIToUTF16("barfoo")); 285 base::string16 input_value(base::ASCIIToUTF16("barfoo"));
291 base::string16 output_value; 286 base::string16 output_value;
292 driver_->RendererShouldAcceptDataListSuggestion(input_value); 287 driver_->RendererShouldAcceptDataListSuggestion(input_value);
293 EXPECT_TRUE(GetString16FromMessageWithID( 288 EXPECT_TRUE(GetString16FromMessageWithID(
294 AutofillMsg_AcceptDataListSuggestion::ID, &output_value)); 289 AutofillMsg_AcceptDataListSuggestion::ID, &output_value));
295 EXPECT_EQ(input_value, output_value); 290 EXPECT_EQ(input_value, output_value);
296 } 291 }
297 292
298 TEST_F(ContentAutofillDriverTest, AcceptPasswordAutofillSuggestion) {
299 base::string16 input_value(base::ASCIIToUTF16("barbaz"));
300 base::string16 output_value;
301 driver_->RendererShouldAcceptPasswordAutofillSuggestion(input_value);
302 EXPECT_TRUE(GetString16FromMessageWithID(
303 AutofillMsg_AcceptPasswordAutofillSuggestion::ID, &output_value));
304 EXPECT_EQ(input_value, output_value);
305 }
306
307 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) { 293 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) {
308 driver_->RendererShouldClearFilledForm(); 294 driver_->RendererShouldClearFilledForm();
309 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); 295 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID));
310 } 296 }
311 297
312 TEST_F(ContentAutofillDriverTest, ClearPreviewedFormSentToRenderer) { 298 TEST_F(ContentAutofillDriverTest, ClearPreviewedFormSentToRenderer) {
313 driver_->RendererShouldClearPreviewedForm(); 299 driver_->RendererShouldClearPreviewedForm();
314 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); 300 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID));
315 } 301 }
316 302
(...skipping 11 matching lines...) Expand all
328 base::string16 input_value(base::ASCIIToUTF16("barqux")); 314 base::string16 input_value(base::ASCIIToUTF16("barqux"));
329 base::string16 output_value; 315 base::string16 output_value;
330 driver_->RendererShouldPreviewFieldWithValue(input_value); 316 driver_->RendererShouldPreviewFieldWithValue(input_value);
331 EXPECT_TRUE(GetString16FromMessageWithID( 317 EXPECT_TRUE(GetString16FromMessageWithID(
332 AutofillMsg_PreviewFieldWithValue::ID, 318 AutofillMsg_PreviewFieldWithValue::ID,
333 &output_value)); 319 &output_value));
334 EXPECT_EQ(input_value, output_value); 320 EXPECT_EQ(input_value, output_value);
335 } 321 }
336 322
337 } // namespace autofill 323 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698