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 "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 FormData output_form_data; | 169 FormData output_form_data; |
170 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&output_page_id, | 170 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&output_page_id, |
171 &output_form_data)); | 171 &output_form_data)); |
172 EXPECT_EQ(input_page_id, output_page_id); | 172 EXPECT_EQ(input_page_id, output_page_id); |
173 EXPECT_EQ(input_form_data, output_form_data); | 173 EXPECT_EQ(input_form_data, output_form_data); |
174 } | 174 } |
175 | 175 |
176 TEST_F(AutofillDriverImplTest, TypePredictionsNotSentToRendererWhenDisabled) { | 176 TEST_F(AutofillDriverImplTest, TypePredictionsNotSentToRendererWhenDisabled) { |
177 FormData form; | 177 FormData form; |
178 test::CreateTestAddressFormData(&form); | 178 test::CreateTestAddressFormData(&form); |
179 FormStructure form_structure(form, std::string()); | 179 FormStructure form_structure(form); |
180 std::vector<FormStructure*> forms(1, &form_structure); | 180 std::vector<FormStructure*> forms(1, &form_structure); |
181 driver_->SendAutofillTypePredictionsToRenderer(forms); | 181 driver_->SendAutofillTypePredictionsToRenderer(forms); |
182 EXPECT_FALSE(GetFieldTypePredictionsAvailable(NULL)); | 182 EXPECT_FALSE(GetFieldTypePredictionsAvailable(NULL)); |
183 } | 183 } |
184 | 184 |
185 TEST_F(AutofillDriverImplTest, TypePredictionsSentToRendererWhenEnabled) { | 185 TEST_F(AutofillDriverImplTest, TypePredictionsSentToRendererWhenEnabled) { |
186 CommandLine::ForCurrentProcess()->AppendSwitch( | 186 CommandLine::ForCurrentProcess()->AppendSwitch( |
187 switches::kShowAutofillTypePredictions); | 187 switches::kShowAutofillTypePredictions); |
188 | 188 |
189 FormData form; | 189 FormData form; |
190 test::CreateTestAddressFormData(&form); | 190 test::CreateTestAddressFormData(&form); |
191 FormStructure form_structure(form, std::string()); | 191 FormStructure form_structure(form); |
192 std::vector<FormStructure*> forms(1, &form_structure); | 192 std::vector<FormStructure*> forms(1, &form_structure); |
193 std::vector<FormDataPredictions> expected_type_predictions; | 193 std::vector<FormDataPredictions> expected_type_predictions; |
194 FormStructure::GetFieldTypePredictions(forms, &expected_type_predictions); | 194 FormStructure::GetFieldTypePredictions(forms, &expected_type_predictions); |
195 driver_->SendAutofillTypePredictionsToRenderer(forms); | 195 driver_->SendAutofillTypePredictionsToRenderer(forms); |
196 | 196 |
197 std::vector<FormDataPredictions> output_type_predictions; | 197 std::vector<FormDataPredictions> output_type_predictions; |
198 EXPECT_TRUE(GetFieldTypePredictionsAvailable(&output_type_predictions)); | 198 EXPECT_TRUE(GetFieldTypePredictionsAvailable(&output_type_predictions)); |
199 EXPECT_EQ(expected_type_predictions, output_type_predictions); | 199 EXPECT_EQ(expected_type_predictions, output_type_predictions); |
200 } | 200 } |
201 | 201 |
(...skipping 13 matching lines...) Expand all Loading... |
215 driver_->RendererShouldClearFilledForm(); | 215 driver_->RendererShouldClearFilledForm(); |
216 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); | 216 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearForm::ID)); |
217 } | 217 } |
218 | 218 |
219 TEST_F(AutofillDriverImplTest, ClearPreviewedFormSentToRenderer) { | 219 TEST_F(AutofillDriverImplTest, ClearPreviewedFormSentToRenderer) { |
220 driver_->RendererShouldClearPreviewedForm(); | 220 driver_->RendererShouldClearPreviewedForm(); |
221 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); | 221 EXPECT_TRUE(HasMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); |
222 } | 222 } |
223 | 223 |
224 } // namespace autofill | 224 } // namespace autofill |
OLD | NEW |