OLD | NEW |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 switch (messageID) { | 159 switch (messageID) { |
160 case AutofillMsg_SetNodeText::ID: | 160 case AutofillMsg_SetNodeText::ID: |
161 if (!AutofillMsg_SetNodeText::Read(message, &autofill_param)) | 161 if (!AutofillMsg_SetNodeText::Read(message, &autofill_param)) |
162 return false; | 162 return false; |
163 break; | 163 break; |
164 case AutofillMsg_AcceptDataListSuggestion::ID: | 164 case AutofillMsg_AcceptDataListSuggestion::ID: |
165 if (!AutofillMsg_AcceptDataListSuggestion::Read(message, | 165 if (!AutofillMsg_AcceptDataListSuggestion::Read(message, |
166 &autofill_param)) | 166 &autofill_param)) |
167 return false; | 167 return false; |
168 break; | 168 break; |
169 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID: | |
170 if (!AutofillMsg_AcceptPasswordAutofillSuggestion::Read( | |
171 message, &autofill_param)) | |
172 return false; | |
173 break; | |
174 default: | 169 default: |
175 NOTREACHED(); | 170 NOTREACHED(); |
176 } | 171 } |
177 if (value) | 172 if (value) |
178 *value = autofill_param.a; | 173 *value = autofill_param.a; |
179 process()->sink().ClearMessages(); | 174 process()->sink().ClearMessages(); |
180 return true; | 175 return true; |
181 } | 176 } |
182 | 177 |
183 // Searches for a message matching |messageID| in the queue of sent IPC | 178 // Searches for a message matching |messageID| in the queue of sent IPC |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 279 |
285 TEST_F(ContentAutofillDriverTest, AcceptDataListSuggestion) { | 280 TEST_F(ContentAutofillDriverTest, AcceptDataListSuggestion) { |
286 base::string16 input_value(base::ASCIIToUTF16("barfoo")); | 281 base::string16 input_value(base::ASCIIToUTF16("barfoo")); |
287 base::string16 output_value; | 282 base::string16 output_value; |
288 driver_->RendererShouldAcceptDataListSuggestion(input_value); | 283 driver_->RendererShouldAcceptDataListSuggestion(input_value); |
289 EXPECT_TRUE(GetString16FromMessageWithID( | 284 EXPECT_TRUE(GetString16FromMessageWithID( |
290 AutofillMsg_AcceptDataListSuggestion::ID, &output_value)); | 285 AutofillMsg_AcceptDataListSuggestion::ID, &output_value)); |
291 EXPECT_EQ(input_value, output_value); | 286 EXPECT_EQ(input_value, output_value); |
292 } | 287 } |
293 | 288 |
294 TEST_F(ContentAutofillDriverTest, AcceptPasswordAutofillSuggestion) { | |
295 base::string16 input_value(base::ASCIIToUTF16("barbaz")); | |
296 base::string16 output_value; | |
297 driver_->RendererShouldAcceptPasswordAutofillSuggestion(input_value); | |
298 EXPECT_TRUE(GetString16FromMessageWithID( | |
299 AutofillMsg_AcceptPasswordAutofillSuggestion::ID, &output_value)); | |
300 EXPECT_EQ(input_value, output_value); | |
301 } | |
302 | |
303 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) { | 289 TEST_F(ContentAutofillDriverTest, ClearFilledFormSentToRenderer) { |
304 driver_->RendererShouldClearFilledForm(); | 290 driver_->RendererShouldClearFilledForm(); |
305 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); | 291 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); |
306 } | 292 } |
307 | 293 |
308 TEST_F(ContentAutofillDriverTest, ClearPreviewedFormSentToRenderer) { | 294 TEST_F(ContentAutofillDriverTest, ClearPreviewedFormSentToRenderer) { |
309 driver_->RendererShouldClearPreviewedForm(); | 295 driver_->RendererShouldClearPreviewedForm(); |
310 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); | 296 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); |
311 } | 297 } |
312 | 298 |
313 TEST_F(ContentAutofillDriverTest, SetNodeText) { | 299 TEST_F(ContentAutofillDriverTest, SetNodeText) { |
314 base::string16 input_value(base::ASCIIToUTF16("barqux")); | 300 base::string16 input_value(base::ASCIIToUTF16("barqux")); |
315 base::string16 output_value; | 301 base::string16 output_value; |
316 driver_->RendererShouldSetNodeText(input_value); | 302 driver_->RendererShouldSetNodeText(input_value); |
317 EXPECT_TRUE( | 303 EXPECT_TRUE( |
318 GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID, &output_value)); | 304 GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID, &output_value)); |
319 EXPECT_EQ(input_value, output_value); | 305 EXPECT_EQ(input_value, output_value); |
320 } | 306 } |
321 | 307 |
322 } // namespace autofill | 308 } // namespace autofill |
OLD | NEW |