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

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

Issue 79103002: Abstracted AcceptPasswordAutofillSuggestion IPC out of core Autofill code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes. Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (!message) 135 if (!message)
136 return false; 136 return false;
137 Tuple1<base::string16> autofill_param; 137 Tuple1<base::string16> autofill_param;
138 switch (messageID) { 138 switch (messageID) {
139 case AutofillMsg_SetNodeText::ID: 139 case AutofillMsg_SetNodeText::ID:
140 AutofillMsg_SetNodeText::Read(message, &autofill_param); 140 AutofillMsg_SetNodeText::Read(message, &autofill_param);
141 break; 141 break;
142 case AutofillMsg_AcceptDataListSuggestion::ID: 142 case AutofillMsg_AcceptDataListSuggestion::ID:
143 AutofillMsg_AcceptDataListSuggestion::Read(message, &autofill_param); 143 AutofillMsg_AcceptDataListSuggestion::Read(message, &autofill_param);
144 break; 144 break;
145 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID:
146 AutofillMsg_AcceptPasswordAutofillSuggestion::Read(
147 message,
148 &autofill_param);
149 break;
145 default: 150 default:
146 NOTREACHED(); 151 NOTREACHED();
147 } 152 }
148 if (value) 153 if (value)
149 *value = autofill_param.a; 154 *value = autofill_param.a;
150 process()->sink().ClearMessages(); 155 process()->sink().ClearMessages();
151 return true; 156 return true;
152 } 157 }
153 158
154 // Searches for a message matching |messageID| in the queue of sent IPC 159 // Searches for a message matching |messageID| in the queue of sent IPC
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 TEST_F(AutofillDriverImplTest, AcceptDataListSuggestion) { 254 TEST_F(AutofillDriverImplTest, AcceptDataListSuggestion) {
250 base::string16 input_value(ASCIIToUTF16("barfoo")); 255 base::string16 input_value(ASCIIToUTF16("barfoo"));
251 base::string16 output_value; 256 base::string16 output_value;
252 driver_->RendererShouldAcceptDataListSuggestion(input_value); 257 driver_->RendererShouldAcceptDataListSuggestion(input_value);
253 EXPECT_TRUE(GetString16FromMessageWithID( 258 EXPECT_TRUE(GetString16FromMessageWithID(
254 AutofillMsg_AcceptDataListSuggestion::ID, 259 AutofillMsg_AcceptDataListSuggestion::ID,
255 &output_value)); 260 &output_value));
256 EXPECT_EQ(input_value, output_value); 261 EXPECT_EQ(input_value, output_value);
257 } 262 }
258 263
264 TEST_F(AutofillDriverImplTest, AcceptPasswordAutofillSuggestion) {
265 base::string16 input_value(ASCIIToUTF16("barbaz"));
266 base::string16 output_value;
267 driver_->RendererShouldAcceptPasswordAutofillSuggestion(input_value);
268 EXPECT_TRUE(GetString16FromMessageWithID(
269 AutofillMsg_AcceptPasswordAutofillSuggestion::ID,
270 &output_value));
271 EXPECT_EQ(input_value, output_value);
272 }
273
259 TEST_F(AutofillDriverImplTest, ClearFilledFormSentToRenderer) { 274 TEST_F(AutofillDriverImplTest, ClearFilledFormSentToRenderer) {
260 driver_->RendererShouldClearFilledForm(); 275 driver_->RendererShouldClearFilledForm();
261 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); 276 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID));
262 } 277 }
263 278
264 TEST_F(AutofillDriverImplTest, ClearPreviewedFormSentToRenderer) { 279 TEST_F(AutofillDriverImplTest, ClearPreviewedFormSentToRenderer) {
265 driver_->RendererShouldClearPreviewedForm(); 280 driver_->RendererShouldClearPreviewedForm();
266 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); 281 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID));
267 } 282 }
268 283
269 TEST_F(AutofillDriverImplTest, SetNodeText) { 284 TEST_F(AutofillDriverImplTest, SetNodeText) {
270 base::string16 input_value(ASCIIToUTF16("barqux")); 285 base::string16 input_value(ASCIIToUTF16("barqux"));
271 base::string16 output_value; 286 base::string16 output_value;
272 driver_->RendererShouldSetNodeText(input_value); 287 driver_->RendererShouldSetNodeText(input_value);
273 EXPECT_TRUE(GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID, 288 EXPECT_TRUE(GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID,
274 &output_value)); 289 &output_value));
275 EXPECT_EQ(input_value, output_value); 290 EXPECT_EQ(input_value, output_value);
276 } 291 }
277 292
278 } // namespace autofill 293 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/autofill_driver_impl.cc ('k') | components/autofill/content/renderer/autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698