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

Side by Side Diff: components/autofill/browser/autofill_manager_unittest.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 const string16 expected_values[], 298 const string16 expected_values[],
299 const string16 expected_labels[], 299 const string16 expected_labels[],
300 const string16 expected_icons[], 300 const string16 expected_icons[],
301 const int expected_unique_ids[]) { 301 const int expected_unique_ids[]) {
302 EXPECT_EQ(expected_page_id, page_id); 302 EXPECT_EQ(expected_page_id, page_id);
303 ASSERT_EQ(expected_num_suggestions, values.size()); 303 ASSERT_EQ(expected_num_suggestions, values.size());
304 ASSERT_EQ(expected_num_suggestions, labels.size()); 304 ASSERT_EQ(expected_num_suggestions, labels.size());
305 ASSERT_EQ(expected_num_suggestions, icons.size()); 305 ASSERT_EQ(expected_num_suggestions, icons.size());
306 ASSERT_EQ(expected_num_suggestions, unique_ids.size()); 306 ASSERT_EQ(expected_num_suggestions, unique_ids.size());
307 for (size_t i = 0; i < expected_num_suggestions; ++i) { 307 for (size_t i = 0; i < expected_num_suggestions; ++i) {
308 SCOPED_TRACE(StringPrintf("i: %" PRIuS, i)); 308 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i));
309 EXPECT_EQ(expected_values[i], values[i]); 309 EXPECT_EQ(expected_values[i], values[i]);
310 EXPECT_EQ(expected_labels[i], labels[i]); 310 EXPECT_EQ(expected_labels[i], labels[i]);
311 EXPECT_EQ(expected_icons[i], icons[i]); 311 EXPECT_EQ(expected_icons[i], icons[i]);
312 EXPECT_EQ(expected_unique_ids[i], unique_ids[i]); 312 EXPECT_EQ(expected_unique_ids[i], unique_ids[i]);
313 } 313 }
314 } 314 }
315 315
316 void ExpectFilledField(const char* expected_label, 316 void ExpectFilledField(const char* expected_label,
317 const char* expected_name, 317 const char* expected_name,
318 const char* expected_value, 318 const char* expected_value,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } else { 504 } else {
505 did_finish_async_form_submit_ = true; 505 did_finish_async_form_submit_ = true;
506 } 506 }
507 507
508 // If we have expected field types set, make sure they match. 508 // If we have expected field types set, make sure they match.
509 if (!expected_submitted_field_types_.empty()) { 509 if (!expected_submitted_field_types_.empty()) {
510 ASSERT_EQ(expected_submitted_field_types_.size(), 510 ASSERT_EQ(expected_submitted_field_types_.size(),
511 submitted_form->field_count()); 511 submitted_form->field_count());
512 for (size_t i = 0; i < expected_submitted_field_types_.size(); ++i) { 512 for (size_t i = 0; i < expected_submitted_field_types_.size(); ++i) {
513 SCOPED_TRACE( 513 SCOPED_TRACE(
514 StringPrintf("Field %d with value %s", static_cast<int>(i), 514 base::StringPrintf(
515 UTF16ToUTF8(submitted_form->field(i)->value).c_str())); 515 "Field %d with value %s", static_cast<int>(i),
516 UTF16ToUTF8(submitted_form->field(i)->value).c_str()));
516 const FieldTypeSet& possible_types = 517 const FieldTypeSet& possible_types =
517 submitted_form->field(i)->possible_types(); 518 submitted_form->field(i)->possible_types();
518 EXPECT_EQ(expected_submitted_field_types_[i].size(), 519 EXPECT_EQ(expected_submitted_field_types_[i].size(),
519 possible_types.size()); 520 possible_types.size());
520 for (FieldTypeSet::const_iterator it = 521 for (FieldTypeSet::const_iterator it =
521 expected_submitted_field_types_[i].begin(); 522 expected_submitted_field_types_[i].begin();
522 it != expected_submitted_field_types_[i].end(); ++it) { 523 it != expected_submitted_field_types_[i].end(); ++it) {
523 EXPECT_TRUE(possible_types.count(*it)) 524 EXPECT_TRUE(possible_types.count(*it))
524 << "Expected type: " << AutofillType::FieldTypeToString(*it); 525 << "Expected type: " << AutofillType::FieldTypeToString(*it);
525 } 526 }
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 3253
3253 FormData form; 3254 FormData form;
3254 CreateTestAddressFormData(&form); 3255 CreateTestAddressFormData(&form);
3255 std::vector<FormData> forms(1, form); 3256 std::vector<FormData> forms(1, form);
3256 FormsSeen(forms); 3257 FormsSeen(forms);
3257 const FormFieldData& field = form.fields[0]; 3258 const FormFieldData& field = form.fields[0];
3258 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 3259 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
3259 3260
3260 autofill_manager_->SetExternalDelegate(NULL); 3261 autofill_manager_->SetExternalDelegate(NULL);
3261 } 3262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698