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

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

Issue 8355025: Fix an Autofill crash caused by accessing the g_browser_process on the DB thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more tests? Created 9 years, 2 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_country.h » ('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) 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 <string> 5 #include <string>
6 6
7 #include "base/message_loop.h"
7 #include "base/string16.h" 8 #include "base/string16.h"
8 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autofill/address.h" 10 #include "chrome/browser/autofill/address.h"
10 #include "chrome/browser/autofill/autofill_type.h" 11 #include "chrome/browser/autofill/autofill_type.h"
12 #include "content/browser/browser_thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 14
13 typedef testing::Test AddressTest; 15 class AddressTest : public testing::Test {
16 public:
17 // In order to access the application locale -- which the tested functions do
18 // internally -- this test must run on the UI thread.
19 AddressTest() : ui_thread_(BrowserThread::UI, &message_loop_) {}
20
21 private:
22 MessageLoopForUI message_loop_;
23 BrowserThread ui_thread_;
24
25 DISALLOW_COPY_AND_ASSIGN(AddressTest);
26 };
14 27
15 // Test that the getters and setters for country code are working. 28 // Test that the getters and setters for country code are working.
16 TEST_F(AddressTest, CountryCode) { 29 TEST_F(AddressTest, CountryCode) {
17 Address address; 30 Address address;
18 EXPECT_EQ(std::string(), address.country_code()); 31 EXPECT_EQ(std::string(), address.country_code());
19 32
20 address.set_country_code("US"); 33 address.set_country_code("US");
21 EXPECT_EQ("US", address.country_code()); 34 EXPECT_EQ("US", address.country_code());
22 35
23 address.set_country_code("CA"); 36 address.set_country_code("CA");
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 EXPECT_EQ(0U, matching_types.size()); 121 EXPECT_EQ(0U, matching_types.size());
109 } 122 }
110 123
111 // Make sure that garbage values don't match when the country code is empty. 124 // Make sure that garbage values don't match when the country code is empty.
112 address.set_country_code(""); 125 address.set_country_code("");
113 EXPECT_EQ(std::string(), address.country_code()); 126 EXPECT_EQ(std::string(), address.country_code());
114 FieldTypeSet matching_types; 127 FieldTypeSet matching_types;
115 address.GetMatchingTypes(ASCIIToUTF16("Garbage"), &matching_types); 128 address.GetMatchingTypes(ASCIIToUTF16("Garbage"), &matching_types);
116 EXPECT_EQ(0U, matching_types.size()); 129 EXPECT_EQ(0U, matching_types.size());
117 } 130 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_country.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698