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

Unified Diff: chrome/browser/autofill/phone_number_i18n_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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/phone_number_i18n_unittest.cc
diff --git a/chrome/browser/autofill/phone_number_i18n_unittest.cc b/chrome/browser/autofill/phone_number_i18n_unittest.cc
index a2eb312c829c2c442b94da24f49ca9986d164fd1..38d83b19d860dc506451c05ea687bbfbba51514b 100644
--- a/chrome/browser/autofill/phone_number_i18n_unittest.cc
+++ b/chrome/browser/autofill/phone_number_i18n_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/phone_number_i18n.h"
+#include "content/browser/browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
using autofill_i18n::NormalizePhoneNumber;
@@ -11,7 +13,16 @@ using autofill_i18n::ParsePhoneNumber;
using autofill_i18n::ConstructPhoneNumber;
using autofill_i18n::PhoneNumbersMatch;
-typedef testing::Test PhoneNumberI18NTest;
+class PhoneNumberI18NTest : 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.
+ PhoneNumberI18NTest() : ui_thread_(BrowserThread::UI, &message_loop_) {}
dhollowa 2011/10/20 15:34:27 I may be missing something here, but how does this
GeorgeY 2011/10/20 19:40:00 AFAIK, yes, creating BrowserThread::UI thread does
+
+ private:
+ MessageLoopForUI message_loop_;
+ BrowserThread ui_thread_;
+};
TEST_F(PhoneNumberI18NTest, NormalizePhoneNumber) {
// "Large" digits.

Powered by Google App Engine
This is Rietveld 408576698