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

Side by Side Diff: chrome/browser/autofill/phone_field_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
« no previous file with comments | « chrome/browser/autofill/billing_address_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/scoped_vector.h" 6 #include "base/scoped_vector.h"
7 #include "chrome/browser/autofill/phone_field.h" 7 #include "chrome/browser/autofill/phone_field.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" 9 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h"
10 #include "webkit/glue/form_field_values.h" 10 #include "webkit/glue/form_field_values.h"
11 11
12 namespace { 12 namespace {
13 13
14 class PhoneFieldTest : public testing::Test { 14 class PhoneFieldTest : public testing::Test {
15 public: 15 public:
16 PhoneFieldTest() {} 16 PhoneFieldTest() {}
17 17
18 protected: 18 protected:
19 ScopedVector<AutoFillField> list_; 19 ScopedVector<AutoFillField> list_;
20 scoped_ptr<PhoneField> field_; 20 scoped_ptr<PhoneField> field_;
21 FieldTypeMap field_type_map_; 21 FieldTypeMap field_type_map_;
22 std::vector<AutoFillField*>::const_iterator iter_; 22 std::vector<AutoFillField*>::const_iterator iter_;
23 23
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(PhoneFieldTest); 25 DISALLOW_COPY_AND_ASSIGN(PhoneFieldTest);
26 }; 26 };
27 27
28 TEST_F(PhoneFieldTest, DeathOnNull) {
29 ASSERT_DEBUG_DEATH(PhoneField::Parse(NULL, false), "");
30 }
31
32 TEST_F(PhoneFieldTest, Empty) { 28 TEST_F(PhoneFieldTest, Empty) {
33 list_.push_back(NULL); 29 list_.push_back(NULL);
34 iter_ = list_.begin(); 30 iter_ = list_.begin();
35 field_.reset(PhoneField::Parse(&iter_, false)); 31 field_.reset(PhoneField::Parse(&iter_, false));
36 ASSERT_EQ(static_cast<PhoneField*>(NULL), field_.get()); 32 ASSERT_EQ(static_cast<PhoneField*>(NULL), field_.get());
37 } 33 }
38 34
39 TEST_F(PhoneFieldTest, NonParse) { 35 TEST_F(PhoneFieldTest, NonParse) {
40 list_.push_back(new AutoFillField); 36 list_.push_back(new AutoFillField);
41 list_.push_back(NULL); 37 list_.push_back(NULL);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_)); 154 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
159 ASSERT_TRUE( 155 ASSERT_TRUE(
160 field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end()); 156 field_type_map_.find(ASCIIToUTF16("areacode1")) != field_type_map_.end());
161 EXPECT_EQ(PHONE_HOME_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]); 157 EXPECT_EQ(PHONE_HOME_CITY_CODE, field_type_map_[ASCIIToUTF16("areacode1")]);
162 ASSERT_TRUE( 158 ASSERT_TRUE(
163 field_type_map_.find(ASCIIToUTF16("phone1")) != field_type_map_.end()); 159 field_type_map_.find(ASCIIToUTF16("phone1")) != field_type_map_.end());
164 EXPECT_EQ(PHONE_HOME_NUMBER, field_type_map_[ASCIIToUTF16("phone1")]); 160 EXPECT_EQ(PHONE_HOME_NUMBER, field_type_map_[ASCIIToUTF16("phone1")]);
165 } 161 }
166 162
167 } // namespace 163 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/billing_address_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698