OLD | NEW |
---|---|
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 bool GetString16FromMessageWithID(uint32 messageID, base::string16* value) { | 132 bool GetString16FromMessageWithID(uint32 messageID, base::string16* value) { |
133 const IPC::Message* message = | 133 const IPC::Message* message = |
134 process()->sink().GetFirstMessageMatching(messageID); | 134 process()->sink().GetFirstMessageMatching(messageID); |
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_PreviewAutoCompleteNode::ID: | |
143 AutofillMsg_PreviewAutoCompleteNode::Read(message, &autofill_param); | |
144 break; | |
142 case AutofillMsg_AcceptDataListSuggestion::ID: | 145 case AutofillMsg_AcceptDataListSuggestion::ID: |
143 AutofillMsg_AcceptDataListSuggestion::Read(message, &autofill_param); | 146 AutofillMsg_AcceptDataListSuggestion::Read(message, &autofill_param); |
144 break; | 147 break; |
145 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID: | 148 case AutofillMsg_AcceptPasswordAutofillSuggestion::ID: |
146 AutofillMsg_AcceptPasswordAutofillSuggestion::Read( | 149 AutofillMsg_AcceptPasswordAutofillSuggestion::Read( |
147 message, | 150 message, |
148 &autofill_param); | 151 &autofill_param); |
149 break; | 152 break; |
150 default: | 153 default: |
151 NOTREACHED(); | 154 NOTREACHED(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); | 284 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); |
282 } | 285 } |
283 | 286 |
284 TEST_F(AutofillDriverImplTest, SetNodeText) { | 287 TEST_F(AutofillDriverImplTest, SetNodeText) { |
285 base::string16 input_value(base::ASCIIToUTF16("barqux")); | 288 base::string16 input_value(base::ASCIIToUTF16("barqux")); |
286 base::string16 output_value; | 289 base::string16 output_value; |
287 driver_->RendererShouldSetNodeText(input_value); | 290 driver_->RendererShouldSetNodeText(input_value); |
288 EXPECT_TRUE(GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID, | 291 EXPECT_TRUE(GetString16FromMessageWithID(AutofillMsg_SetNodeText::ID, |
289 &output_value)); | 292 &output_value)); |
290 EXPECT_EQ(input_value, output_value); | 293 EXPECT_EQ(input_value, output_value); |
291 } | 294 } |
Ilya Sherman
2014/02/22 05:59:51
nit: Please add a blank line after this one.
ziran.sun
2014/02/27 15:38:11
Done.
| |
295 TEST_F(AutofillDriverImplTest, PreviewAutoCompleteNode) { | |
296 base::string16 input_value(base::ASCIIToUTF16("barqux")); | |
297 base::string16 output_value; | |
298 driver_->RendererShouldPreviewAutoCompleteNode(input_value); | |
299 EXPECT_TRUE(GetString16FromMessageWithID( | |
300 AutofillMsg_PreviewAutoCompleteNode::ID, | |
301 &output_value)); | |
302 EXPECT_EQ(input_value, output_value); | |
303 } | |
292 | 304 |
293 } // namespace autofill | 305 } // namespace autofill |
OLD | NEW |