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

Side by Side Diff: chrome/browser/autofill/autofill_metrics_unittest.cc

Issue 6625087: Convert autofill messages to use the new IPC macros (again). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 5 #include <vector>
6 6
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 FormData form; 218 FormData form;
219 form.name = ASCIIToUTF16("TestForm"); 219 form.name = ASCIIToUTF16("TestForm");
220 form.method = ASCIIToUTF16("POST"); 220 form.method = ASCIIToUTF16("POST");
221 form.origin = GURL("http://example.com/form.html"); 221 form.origin = GURL("http://example.com/form.html");
222 form.action = GURL("http://example.com/submit.html"); 222 form.action = GURL("http://example.com/submit.html");
223 form.user_submitted = true; 223 form.user_submitted = true;
224 224
225 FormField field; 225 FormField field;
226 autofill_test::CreateTestFormField( 226 autofill_test::CreateTestFormField(
227 "Autofilled", "autofilled", "Elvis Presley", "text", &field); 227 "Autofilled", "autofilled", "Elvis Presley", "text", &field);
228 field.set_autofilled(true); 228 field.is_autofilled = true;
229 form.fields.push_back(field); 229 form.fields.push_back(field);
230 autofill_test::CreateTestFormField( 230 autofill_test::CreateTestFormField(
231 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); 231 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field);
232 form.fields.push_back(field); 232 form.fields.push_back(field);
233 autofill_test::CreateTestFormField( 233 autofill_test::CreateTestFormField(
234 "Empty", "empty", "", "text", &field); 234 "Empty", "empty", "", "text", &field);
235 form.fields.push_back(field); 235 form.fields.push_back(field);
236 autofill_test::CreateTestFormField( 236 autofill_test::CreateTestFormField(
237 "Unknown", "unknown", "garbage", "text", &field); 237 "Unknown", "unknown", "garbage", "text", &field);
238 form.fields.push_back(field); 238 form.fields.push_back(field);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 form.method = ASCIIToUTF16("POST"); 388 form.method = ASCIIToUTF16("POST");
389 form.origin = GURL("http://example.com/form.html"); 389 form.origin = GURL("http://example.com/form.html");
390 form.action = GURL("http://example.com/submit.html"); 390 form.action = GURL("http://example.com/submit.html");
391 form.user_submitted = true; 391 form.user_submitted = true;
392 392
393 std::vector<AutofillFieldType> heuristic_types, server_types; 393 std::vector<AutofillFieldType> heuristic_types, server_types;
394 394
395 FormField field; 395 FormField field;
396 autofill_test::CreateTestFormField( 396 autofill_test::CreateTestFormField(
397 "Both match", "match", "Elvis Presley", "text", &field); 397 "Both match", "match", "Elvis Presley", "text", &field);
398 field.set_autofilled(true); 398 field.is_autofilled = true;
399 form.fields.push_back(field); 399 form.fields.push_back(field);
400 heuristic_types.push_back(NAME_FULL); 400 heuristic_types.push_back(NAME_FULL);
401 server_types.push_back(NAME_FULL); 401 server_types.push_back(NAME_FULL);
402 autofill_test::CreateTestFormField( 402 autofill_test::CreateTestFormField(
403 "Both mismatch", "mismatch", "buddy@gmail.com", "text", &field); 403 "Both mismatch", "mismatch", "buddy@gmail.com", "text", &field);
404 form.fields.push_back(field); 404 form.fields.push_back(field);
405 heuristic_types.push_back(PHONE_HOME_NUMBER); 405 heuristic_types.push_back(PHONE_HOME_NUMBER);
406 server_types.push_back(PHONE_HOME_NUMBER); 406 server_types.push_back(PHONE_HOME_NUMBER);
407 autofill_test::CreateTestFormField( 407 autofill_test::CreateTestFormField(
408 "Only heuristics match", "mixed", "Memphis", "text", &field); 408 "Only heuristics match", "mixed", "Memphis", "text", &field);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 FormData form; 477 FormData form;
478 form.name = ASCIIToUTF16("TestForm"); 478 form.name = ASCIIToUTF16("TestForm");
479 form.method = ASCIIToUTF16("POST"); 479 form.method = ASCIIToUTF16("POST");
480 form.origin = GURL("http://example.com/form.html"); 480 form.origin = GURL("http://example.com/form.html");
481 form.action = GURL("http://example.com/submit.html"); 481 form.action = GURL("http://example.com/submit.html");
482 form.user_submitted = true; 482 form.user_submitted = true;
483 483
484 FormField field; 484 FormField field;
485 autofill_test::CreateTestFormField( 485 autofill_test::CreateTestFormField(
486 "Autofilled", "autofilled", "Elvis Presley", "text", &field); 486 "Autofilled", "autofilled", "Elvis Presley", "text", &field);
487 field.set_autofilled(true); 487 field.is_autofilled = true;
488 form.fields.push_back(field); 488 form.fields.push_back(field);
489 autofill_test::CreateTestFormField( 489 autofill_test::CreateTestFormField(
490 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); 490 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field);
491 form.fields.push_back(field); 491 form.fields.push_back(field);
492 492
493 // Simulate form submission. 493 // Simulate form submission.
494 EXPECT_CALL(*autofill_manager_->metric_logger(), 494 EXPECT_CALL(*autofill_manager_->metric_logger(),
495 Log(AutofillMetrics::FIELD_SUBMITTED, std::string())).Times(0); 495 Log(AutofillMetrics::FIELD_SUBMITTED, std::string())).Times(0);
496 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form)); 496 EXPECT_NO_FATAL_FAILURE(autofill_manager_->OnFormSubmitted(form));
497 497
(...skipping 15 matching lines...) Expand all
513 FormData form; 513 FormData form;
514 form.name = ASCIIToUTF16("TestForm"); 514 form.name = ASCIIToUTF16("TestForm");
515 form.method = ASCIIToUTF16("POST"); 515 form.method = ASCIIToUTF16("POST");
516 form.origin = GURL("http://example.com/form.html"); 516 form.origin = GURL("http://example.com/form.html");
517 form.action = GURL("http://example.com/submit.html"); 517 form.action = GURL("http://example.com/submit.html");
518 form.user_submitted = true; 518 form.user_submitted = true;
519 519
520 FormField field; 520 FormField field;
521 autofill_test::CreateTestFormField( 521 autofill_test::CreateTestFormField(
522 "Autofilled", "autofilled", "Elvis Presley", "text", &field); 522 "Autofilled", "autofilled", "Elvis Presley", "text", &field);
523 field.set_autofilled(true); 523 field.is_autofilled = true;
524 form.fields.push_back(field); 524 form.fields.push_back(field);
525 autofill_test::CreateTestFormField( 525 autofill_test::CreateTestFormField(
526 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); 526 "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field);
527 form.fields.push_back(field); 527 form.fields.push_back(field);
528 autofill_test::CreateTestFormField( 528 autofill_test::CreateTestFormField(
529 "Empty", "empty", "", "text", &field); 529 "Empty", "empty", "", "text", &field);
530 form.fields.push_back(field); 530 form.fields.push_back(field);
531 autofill_test::CreateTestFormField( 531 autofill_test::CreateTestFormField(
532 "Unknown", "unknown", "garbage", "text", &field); 532 "Unknown", "unknown", "garbage", "text", &field);
533 form.fields.push_back(field); 533 form.fields.push_back(field);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 // The metric should be logged when the profiles are first loaded. 574 // The metric should be logged when the profiles are first loaded.
575 EXPECT_CALL(*test_personal_data_->metric_logger(), 575 EXPECT_CALL(*test_personal_data_->metric_logger(),
576 LogProfileCount(3)).Times(1); 576 LogProfileCount(3)).Times(1);
577 test_personal_data_->LoadProfiles(); 577 test_personal_data_->LoadProfiles();
578 578
579 // The metric should only be logged once. 579 // The metric should only be logged once.
580 EXPECT_CALL(*test_personal_data_->metric_logger(), 580 EXPECT_CALL(*test_personal_data_->metric_logger(),
581 LogProfileCount(::testing::_)).Times(0); 581 LogProfileCount(::testing::_)).Times(0);
582 test_personal_data_->LoadProfiles(); 582 test_personal_data_->LoadProfiles();
583 } 583 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_merge_unittest.cc ('k') | chrome/browser/autofill/credit_card_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698