Fix an Autofill crash caused by accessing the g_browser_process on the DB thread.
This is meant as a minimal-impact CL, so that it should be safe to merge to M16. The more complete fix is being tracked in bug 100845.
BUG=100745
TEST=less crashy
Review URL: http://codereview.chromium.org/8355025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106822 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc
index 10d2414..fa4069b 100644
--- a/chrome/browser/autofill/address_unittest.cc
+++ b/chrome/browser/autofill/address_unittest.cc
@@ -4,13 +4,26 @@
#include <string>
+#include "base/message_loop.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/address.h"
#include "chrome/browser/autofill/autofill_type.h"
+#include "content/browser/browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test AddressTest;
+class AddressTest : public testing::Test {
+ public:
+ // In order to access the application locale -- which the tested functions do
+ // internally -- this test must run on the UI thread.
+ AddressTest() : ui_thread_(BrowserThread::UI, &message_loop_) {}
+
+ private:
+ MessageLoopForUI message_loop_;
+ BrowserThread ui_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(AddressTest);
+};
// Test that the getters and setters for country code are working.
TEST_F(AddressTest, CountryCode) {