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

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

Issue 1400001: Removing AutoFill Death Tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autofill/address.h" 10 #include "chrome/browser/autofill/address.h"
(...skipping 18 matching lines...) Expand all
29 ASCIIToUTF16("USA")); 29 ASCIIToUTF16("USA"));
30 } 30 }
31 31
32 protected: 32 protected:
33 BillingAddress address_; 33 BillingAddress address_;
34 34
35 DISALLOW_COPY_AND_ASSIGN(BillingAddressTest); 35 DISALLOW_COPY_AND_ASSIGN(BillingAddressTest);
36 }; 36 };
37 37
38 TEST_F(BillingAddressTest, GetPossibleFieldTypes) { 38 TEST_F(BillingAddressTest, GetPossibleFieldTypes) {
39 // DCHECK on NULL |possible_types|.
40 ASSERT_DEBUG_DEATH(address_.GetPossibleFieldTypes(string16(), NULL), "");
41
42 // Empty string. 39 // Empty string.
43 FieldTypeSet possible_types; 40 FieldTypeSet possible_types;
44 address_.GetPossibleFieldTypes(string16(), &possible_types); 41 address_.GetPossibleFieldTypes(string16(), &possible_types);
45 ASSERT_EQ(0U, possible_types.size()); 42 ASSERT_EQ(0U, possible_types.size());
46 43
47 // Only use split-chars for the address_. 44 // Only use split-chars for the address_.
48 possible_types.clear(); 45 possible_types.clear();
49 address_.GetPossibleFieldTypes(ASCIIToUTF16("-,#. "), &possible_types); 46 address_.GetPossibleFieldTypes(ASCIIToUTF16("-,#. "), &possible_types);
50 ASSERT_EQ(0U, possible_types.size()); 47 ASSERT_EQ(0U, possible_types.size());
51 48
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 possible_types.end()); 349 possible_types.end());
353 350
354 // LINE1 is empty. 351 // LINE1 is empty.
355 address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1), string16()); 352 address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1), string16());
356 possible_types.clear(); 353 possible_types.clear();
357 address_.GetPossibleFieldTypes(string16(), &possible_types); 354 address_.GetPossibleFieldTypes(string16(), &possible_types);
358 ASSERT_EQ(0U, possible_types.size()); 355 ASSERT_EQ(0U, possible_types.size());
359 } 356 }
360 357
361 TEST_F(BillingAddressTest, FindInfoMatches) { 358 TEST_F(BillingAddressTest, FindInfoMatches) {
362 // DCHECK on NULL |matched_text|.
363 ASSERT_DEBUG_DEATH(address_.FindInfoMatches(
364 AutoFillType(ADDRESS_BILLING_LINE1), string16(), NULL), "");
365
366 // ADDRESS_BILLING_LINE1 ===================================================== 359 // ADDRESS_BILLING_LINE1 =====================================================
367 360
368 // Match the beginning of the string. 361 // Match the beginning of the string.
369 std::vector<string16> matches; 362 std::vector<string16> matches;
370 address_.FindInfoMatches( 363 address_.FindInfoMatches(
371 AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16("123"), &matches); 364 AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16("123"), &matches);
372 ASSERT_EQ(1U, matches.size()); 365 ASSERT_EQ(1U, matches.size());
373 EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]); 366 EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
374 367
375 // Search has too many characters. 368 // Search has too many characters.
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 EXPECT_EQ(ASCIIToUTF16("USA"), text); 778 EXPECT_EQ(ASCIIToUTF16("USA"), text);
786 779
787 // Verify that the clone is a copy and not a reference. 780 // Verify that the clone is a copy and not a reference.
788 address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1), 781 address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1),
789 ASCIIToUTF16("654 Bowling Terrace")); 782 ASCIIToUTF16("654 Bowling Terrace"));
790 text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1)); 783 text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
791 EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text); 784 EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
792 } 785 }
793 786
794 } // namespace 787 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_infobar_delegate_unittest.cc ('k') | chrome/browser/autofill/phone_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698