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

Side by Side Diff: chrome/browser/autofill/address_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 | « no previous file | chrome/browser/autofill/autofill_infobar_delegate_unittest.cc » ('j') | 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/address_field.h" 7 #include "chrome/browser/autofill/address_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 AddressFieldTest : public testing::Test { 14 class AddressFieldTest : public testing::Test {
15 public: 15 public:
16 AddressFieldTest() {} 16 AddressFieldTest() {}
17 17
18 protected: 18 protected:
19 ScopedVector<AutoFillField> list_; 19 ScopedVector<AutoFillField> list_;
20 scoped_ptr<AddressField> field_; 20 scoped_ptr<AddressField> 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(AddressFieldTest); 25 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest);
26 }; 26 };
27 27
28 TEST_F(AddressFieldTest, DeathOnNull) {
29 ASSERT_DEBUG_DEATH(AddressField::Parse(NULL, false), "");
30 }
31
32 TEST_F(AddressFieldTest, Empty) { 28 TEST_F(AddressFieldTest, Empty) {
33 list_.push_back(NULL); 29 list_.push_back(NULL);
34 iter_ = list_.begin(); 30 iter_ = list_.begin();
35 field_.reset(AddressField::Parse(&iter_, false)); 31 field_.reset(AddressField::Parse(&iter_, false));
36 ASSERT_EQ(static_cast<AddressField*>(NULL), field_.get()); 32 ASSERT_EQ(static_cast<AddressField*>(NULL), field_.get());
37 } 33 }
38 34
39 TEST_F(AddressFieldTest, NonParse) { 35 TEST_F(AddressFieldTest, NonParse) {
40 list_.push_back(new AutoFillField); 36 list_.push_back(new AutoFillField);
41 list_.push_back(NULL); 37 list_.push_back(NULL);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get()); 294 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
299 EXPECT_EQ(kGenericAddress, field_->FindType()); 295 EXPECT_EQ(kGenericAddress, field_->FindType());
300 EXPECT_FALSE(field_->IsFullAddress()); 296 EXPECT_FALSE(field_->IsFullAddress());
301 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_)); 297 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
302 ASSERT_TRUE( 298 ASSERT_TRUE(
303 field_type_map_.find(ASCIIToUTF16("country1")) != field_type_map_.end()); 299 field_type_map_.find(ASCIIToUTF16("country1")) != field_type_map_.end());
304 EXPECT_EQ(ADDRESS_HOME_COUNTRY, field_type_map_[ASCIIToUTF16("country1")]); 300 EXPECT_EQ(ADDRESS_HOME_COUNTRY, field_type_map_[ASCIIToUTF16("country1")]);
305 } 301 }
306 302
307 } // namespace 303 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_infobar_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698