| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 TypePredictionsNotSentToRendererWhenDisabled) { | 258 TypePredictionsNotSentToRendererWhenDisabled) { |
| 259 FormData form; | 259 FormData form; |
| 260 test::CreateTestAddressFormData(&form); | 260 test::CreateTestAddressFormData(&form); |
| 261 FormStructure form_structure(form); | 261 FormStructure form_structure(form); |
| 262 std::vector<FormStructure*> forms(1, &form_structure); | 262 std::vector<FormStructure*> forms(1, &form_structure); |
| 263 driver_->SendAutofillTypePredictionsToRenderer(forms); | 263 driver_->SendAutofillTypePredictionsToRenderer(forms); |
| 264 EXPECT_FALSE(GetFieldTypePredictionsAvailable(NULL)); | 264 EXPECT_FALSE(GetFieldTypePredictionsAvailable(NULL)); |
| 265 } | 265 } |
| 266 | 266 |
| 267 TEST_F(ContentAutofillDriverTest, TypePredictionsSentToRendererWhenEnabled) { | 267 TEST_F(ContentAutofillDriverTest, TypePredictionsSentToRendererWhenEnabled) { |
| 268 CommandLine::ForCurrentProcess()->AppendSwitch( | 268 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 269 switches::kShowAutofillTypePredictions); | 269 switches::kShowAutofillTypePredictions); |
| 270 | 270 |
| 271 FormData form; | 271 FormData form; |
| 272 test::CreateTestAddressFormData(&form); | 272 test::CreateTestAddressFormData(&form); |
| 273 FormStructure form_structure(form); | 273 FormStructure form_structure(form); |
| 274 std::vector<FormStructure*> forms(1, &form_structure); | 274 std::vector<FormStructure*> forms(1, &form_structure); |
| 275 std::vector<FormDataPredictions> expected_type_predictions; | 275 std::vector<FormDataPredictions> expected_type_predictions; |
| 276 FormStructure::GetFieldTypePredictions(forms, &expected_type_predictions); | 276 FormStructure::GetFieldTypePredictions(forms, &expected_type_predictions); |
| 277 driver_->SendAutofillTypePredictionsToRenderer(forms); | 277 driver_->SendAutofillTypePredictionsToRenderer(forms); |
| 278 | 278 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 base::string16 input_value(base::ASCIIToUTF16("barqux")); | 314 base::string16 input_value(base::ASCIIToUTF16("barqux")); |
| 315 base::string16 output_value; | 315 base::string16 output_value; |
| 316 driver_->RendererShouldPreviewFieldWithValue(input_value); | 316 driver_->RendererShouldPreviewFieldWithValue(input_value); |
| 317 EXPECT_TRUE(GetString16FromMessageWithID( | 317 EXPECT_TRUE(GetString16FromMessageWithID( |
| 318 AutofillMsg_PreviewFieldWithValue::ID, | 318 AutofillMsg_PreviewFieldWithValue::ID, |
| 319 &output_value)); | 319 &output_value)); |
| 320 EXPECT_EQ(input_value, output_value); | 320 EXPECT_EQ(input_value, output_value); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace autofill | 323 } // namespace autofill |
| OLD | NEW |