diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 23:02:21 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 23:02:21 +0000 |
commit | a5f9f373450f82d5a0a107473da6cd5f232d4ec9 (patch) | |
tree | 27ced074b40f2e39d664b1bd070de45718b4d4c8 /chrome | |
parent | bf3fbd6347853955d7f3df8603e19b81db13a9f7 (diff) | |
download | chromium_src-a5f9f373450f82d5a0a107473da6cd5f232d4ec9.zip chromium_src-a5f9f373450f82d5a0a107473da6cd5f232d4ec9.tar.gz chromium_src-a5f9f373450f82d5a0a107473da6cd5f232d4ec9.tar.bz2 |
GTTF: Use a fresh TestingBrowserProcess for each test, part #4
For a detailed description see part #1, http://codereview.chromium.org/6478005/
BUG=61062
TEST=unit_tests, possibly more
Review URL: http://codereview.chromium.org/7465041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
88 files changed, 263 insertions, 153 deletions
diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc index 7691ac0..d9d7014 100644 --- a/chrome/browser/autofill/address_unittest.cc +++ b/chrome/browser/autofill/address_unittest.cc @@ -8,10 +8,13 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/address.h" #include "chrome/browser/autofill/autofill_type.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" +typedef TestingBrowserProcessTest AddressTest; + // Test that the getters and setters for country code are working. -TEST(AddressTest, CountryCode) { +TEST_F(AddressTest, CountryCode) { Address address; EXPECT_EQ(std::string(), address.country_code()); @@ -23,7 +26,7 @@ TEST(AddressTest, CountryCode) { } // Test that country codes are properly decoded as country names. -TEST(AddressTest, GetCountry) { +TEST_F(AddressTest, GetCountry) { Address address; EXPECT_EQ(std::string(), address.country_code()); @@ -41,7 +44,7 @@ TEST(AddressTest, GetCountry) { } // Test that we properly detect country codes appropriate for each country. -TEST(AddressTest, SetCountry) { +TEST_F(AddressTest, SetCountry) { Address address; EXPECT_EQ(std::string(), address.country_code()); @@ -77,7 +80,7 @@ TEST(AddressTest, SetCountry) { } // Test that we properly match typed values to stored country data. -TEST(AddressTest, IsCountry) { +TEST_F(AddressTest, IsCountry) { Address address; address.set_country_code("US"); diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc index f98e52a..b6f235c 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/autofill/field_types.h" #include "chrome/browser/sync/util/data_encryption.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; @@ -107,7 +108,7 @@ void CreateSubkey(RegKey* key, wchar_t const* subkey_name, } // namespace -class AutofillIeToolbarImportTest : public testing::Test { +class AutofillIeToolbarImportTest : public TestingBrowserProcessTest { public: AutofillIeToolbarImportTest(); diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index e754a34..9b8071c 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/autofill/data_driven_test.h" #include "chrome/browser/autofill/form_structure.h" #include "chrome/browser/autofill/personal_data_manager.h" +#include "chrome/test/testing_browser_process_test.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" @@ -112,7 +113,8 @@ const std::vector<AutofillProfile*>& PersonalDataManagerMock::web_profiles() // corresponding output file is a dump of the saved profiles that result from // importing the input profiles. The output file format is identical to the // input format. -class AutofillMergeTest : public testing::Test, public DataDrivenTest { +class AutofillMergeTest : public TestingBrowserProcessTest, + public DataDrivenTest { protected: AutofillMergeTest(); virtual ~AutofillMergeTest(); diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index a5fa207..df83ae1 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/common/guid.h" +#include "chrome/test/testing_browser_process_test.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,9 +25,11 @@ bool UpdateProfileLabel(AutofillProfile *profile) { } // namespace +typedef TestingBrowserProcessTest AutofillProfileTest; + // Tests different possibilities for summary string generation. // Based on existence of first name, last name, and address line 1. -TEST(AutofillProfileTest, PreviewSummaryString) { +TEST_F(AutofillProfileTest, PreviewSummaryString) { // Case 0/null: "" AutofillProfile profile0; // Empty profile - nothing to update. @@ -128,7 +131,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "Marion Mitchell Morrison, 123 Zoo St., marion@me.xyz"), summary7a); } -TEST(AutofillProfileTest, AdjustInferredLabels) { +TEST_F(AutofillProfileTest, AdjustInferredLabels) { std::vector<AutofillProfile*> profiles; profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo( @@ -294,7 +297,7 @@ TEST(AutofillProfileTest, AdjustInferredLabels) { STLDeleteContainerPointers(profiles.begin(), profiles.end()); } -TEST(AutofillProfileTest, CreateInferredLabels) { +TEST_F(AutofillProfileTest, CreateInferredLabels) { std::vector<AutofillProfile*> profiles; profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], @@ -396,7 +399,7 @@ TEST(AutofillProfileTest, CreateInferredLabels) { // Test that we fall back to using the full name if there are no other // distinguishing fields, but only if it makes sense given the suggested fields. -TEST(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { +TEST_F(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { ScopedVector<AutofillProfile> profiles; profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], @@ -430,7 +433,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { } // Test that we do not show duplicate fields in the labels. -TEST(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { +TEST_F(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { ScopedVector<AutofillProfile> profiles; profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], @@ -456,7 +459,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { } // Make sure that empty fields are not treated as distinguishing fields. -TEST(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { +TEST_F(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { ScopedVector<AutofillProfile> profiles; profiles.push_back(new AutofillProfile); autofill_test::SetProfileInfo(profiles[0], @@ -491,7 +494,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com"), labels[2]); } -TEST(AutofillProfileTest, IsSubsetOf) { +TEST_F(AutofillProfileTest, IsSubsetOf) { scoped_ptr<AutofillProfile> a, b; // |a| is a subset of |b|. @@ -523,7 +526,7 @@ TEST(AutofillProfileTest, IsSubsetOf) { EXPECT_FALSE(a->IsSubsetOf(*b)); } -TEST(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { +TEST_F(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { scoped_ptr<AutofillProfile> a, b; // Intersection of types contains the fields NAME_FIRST, NAME_LAST, @@ -563,7 +566,7 @@ TEST(AutofillProfileTest, IntersectionOfTypesHasEqualValues) { EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); } -TEST(AutofillProfileTest, MergeWith) { +TEST_F(AutofillProfileTest, MergeWith) { scoped_ptr<AutofillProfile> a, b; // Merge |b| into |a|. @@ -586,7 +589,7 @@ TEST(AutofillProfileTest, MergeWith) { EXPECT_EQ(0, expected_b.Compare(*b)); } -TEST(AutofillProfileTest, AssignmentOperator){ +TEST_F(AutofillProfileTest, AssignmentOperator){ AutofillProfile a, b; // Result of assignment should be logically equal to the original profile. @@ -602,7 +605,7 @@ TEST(AutofillProfileTest, AssignmentOperator){ EXPECT_TRUE(a == b); } -TEST(AutofillProfileTest, Copy) { +TEST_F(AutofillProfileTest, Copy) { AutofillProfile a; // Clone should be logically equal to the original. @@ -614,7 +617,7 @@ TEST(AutofillProfileTest, Copy) { EXPECT_TRUE(a == b); } -TEST(AutofillProfileTest, Compare) { +TEST_F(AutofillProfileTest, Compare) { AutofillProfile a, b; // Empty profiles are the same. @@ -634,7 +637,7 @@ TEST(AutofillProfileTest, Compare) { EXPECT_LT(0, b.Compare(a)); } -TEST(AutofillProfileTest, CountryCode) { +TEST_F(AutofillProfileTest, CountryCode) { AutofillProfile profile; EXPECT_EQ(std::string(), profile.CountryCode()); @@ -642,7 +645,7 @@ TEST(AutofillProfileTest, CountryCode) { EXPECT_EQ("US", profile.CountryCode()); } -TEST(AutofillProfileTest, MultiValueNames) { +TEST_F(AutofillProfileTest, MultiValueNames) { AutofillProfile p; const string16 kJohnDoe(ASCIIToUTF16("John Doe")); const string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); @@ -686,7 +689,7 @@ TEST(AutofillProfileTest, MultiValueNames) { EXPECT_EQ(string16(), p.GetInfo(NAME_FULL)); } -TEST(AutofillProfileTest, MultiValueEmails) { +TEST_F(AutofillProfileTest, MultiValueEmails) { AutofillProfile p; const string16 kJohnDoe(ASCIIToUTF16("john@doe.com")); const string16 kJohnPDoe(ASCIIToUTF16("john_p@doe.com")); @@ -730,7 +733,7 @@ TEST(AutofillProfileTest, MultiValueEmails) { EXPECT_EQ(string16(), p.GetInfo(EMAIL_ADDRESS)); } -TEST(AutofillProfileTest, MultiValuePhone) { +TEST_F(AutofillProfileTest, MultiValuePhone) { AutofillProfile p; const string16 kJohnDoe(ASCIIToUTF16("4151112222")); const string16 kJohnPDoe(ASCIIToUTF16("4151113333")); @@ -774,7 +777,7 @@ TEST(AutofillProfileTest, MultiValuePhone) { EXPECT_EQ(string16(), p.GetInfo(PHONE_HOME_WHOLE_NUMBER)); } -TEST(AutofillProfileTest, MultiValueFax) { +TEST_F(AutofillProfileTest, MultiValueFax) { AutofillProfile p; const string16 kJohnDoe(ASCIIToUTF16("4152112222")); const string16 kJohnPDoe(ASCIIToUTF16("4153113333")); diff --git a/chrome/browser/autofill/credit_card_unittest.cc b/chrome/browser/autofill/credit_card_unittest.cc index 51e551f..3d96f31 100644 --- a/chrome/browser/autofill/credit_card_unittest.cc +++ b/chrome/browser/autofill/credit_card_unittest.cc @@ -6,6 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/credit_card.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -39,10 +40,12 @@ const char* const kInvalidNumbers[] = { } // namespace +typedef TestingBrowserProcessTest CreditCardTest; + // Tests credit card summary string generation. This test simulates a variety // of different possible summary strings. Variations occur based on the // existence of credit card number, month, and year fields. -TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { +TEST_F(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 0: empty credit card. CreditCard credit_card0; string16 summary0 = credit_card0.Label(); @@ -96,7 +99,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { EXPECT_EQ(ASCIIToUTF16("************5100"), obfuscated4); } -TEST(CreditCardTest, AssignmentOperator) { +TEST_F(CreditCardTest, AssignmentOperator) { CreditCard a, b; // Result of assignment should be logically equal to the original profile. @@ -110,7 +113,7 @@ TEST(CreditCardTest, AssignmentOperator) { EXPECT_TRUE(a == b); } -TEST(CreditCardTest, IsValidCreditCardNumber) { +TEST_F(CreditCardTest, IsValidCreditCardNumber) { for (size_t i = 0; i < arraysize(kValidNumbers); ++i) { SCOPED_TRACE(kValidNumbers[i]); EXPECT_TRUE( @@ -123,7 +126,7 @@ TEST(CreditCardTest, IsValidCreditCardNumber) { } } -TEST(CreditCardTest, IsComplete) { +TEST_F(CreditCardTest, IsComplete) { CreditCard card; EXPECT_FALSE(card.IsComplete()); card.SetInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Wally T. Walrus")); @@ -144,7 +147,7 @@ TEST(CreditCardTest, IsComplete) { } } -TEST(CreditCardTest, InvalidMastercardNumber) { +TEST_F(CreditCardTest, InvalidMastercardNumber) { CreditCard card; autofill_test::SetCreditCardInfo(&card, "Baby Face Nelson", @@ -153,7 +156,7 @@ TEST(CreditCardTest, InvalidMastercardNumber) { } // Verify that we preserve exactly what the user typed for credit card numbers. -TEST(CreditCardTest, SetInfoCreditCardNumber) { +TEST_F(CreditCardTest, SetInfoCreditCardNumber) { CreditCard card; autofill_test::SetCreditCardInfo(&card, "Bob Dylan", @@ -163,7 +166,7 @@ TEST(CreditCardTest, SetInfoCreditCardNumber) { } // Verify that we can handle both numeric and named months. -TEST(CreditCardTest, SetInfoExpirationMonth) { +TEST_F(CreditCardTest, SetInfoExpirationMonth) { CreditCard card; card.SetInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("05")); diff --git a/chrome/browser/autofill/phone_number_i18n_unittest.cc b/chrome/browser/autofill/phone_number_i18n_unittest.cc index 0bc466d..a3dfdad 100644 --- a/chrome/browser/autofill/phone_number_i18n_unittest.cc +++ b/chrome/browser/autofill/phone_number_i18n_unittest.cc @@ -4,6 +4,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/phone_number_i18n.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" using autofill_i18n::NormalizePhoneNumber; @@ -13,7 +14,9 @@ using autofill_i18n::FormatPhone; using autofill_i18n::ComparePhones; using autofill_i18n::PhoneNumbersMatch; -TEST(PhoneNumberI18NTest, NormalizePhoneNumber) { +typedef TestingBrowserProcessTest PhoneNumberI18NTest; + +TEST_F(PhoneNumberI18NTest, NormalizePhoneNumber) { // "Large" digits. string16 phone1(UTF8ToUTF16("\xEF\xBC\x91\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90" "\xEF\xBC\x97\xEF\xBC\x94\xEF\xBC\x99\xEF\xBC\x98" @@ -35,7 +38,7 @@ TEST(PhoneNumberI18NTest, NormalizePhoneNumber) { EXPECT_EQ(NormalizePhoneNumber(phone5, "US"), ASCIIToUTF16("6502346789")); } -TEST(PhoneNumberI18NTest, ParsePhoneNumber) { +TEST_F(PhoneNumberI18NTest, ParsePhoneNumber) { string16 number; string16 city_code; string16 country_code; @@ -243,7 +246,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { EXPECT_EQ(ASCIIToUTF16("1"), country_code); } -TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { +TEST_F(PhoneNumberI18NTest, ConstructPhoneNumber) { string16 number; EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), ASCIIToUTF16("650"), @@ -321,7 +324,7 @@ TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { EXPECT_EQ(number, ASCIIToUTF16("+49 2423/45678901")); } -TEST(PhoneNumberI18NTest, FormatPhone) { +TEST_F(PhoneNumberI18NTest, FormatPhone) { EXPECT_EQ(FormatPhone(ASCIIToUTF16("1[650]234-56-78"), "US", autofill_i18n::NATIONAL), ASCIIToUTF16("(650) 234-5678")); @@ -342,7 +345,7 @@ TEST(PhoneNumberI18NTest, FormatPhone) { ASCIIToUTF16("+420 16502345678")); } -TEST(PhoneNumberI18NTest, ComparePhones) { +TEST_F(PhoneNumberI18NTest, ComparePhones) { EXPECT_EQ(ComparePhones(ASCIIToUTF16("1(650)234-56-78"), ASCIIToUTF16("+16502345678"), "US"), @@ -369,7 +372,7 @@ TEST(PhoneNumberI18NTest, ComparePhones) { autofill_i18n::PHONES_NOT_EQUAL); } -TEST(PhoneNumberI18NTest, PhoneNumbersMatch) { +TEST_F(PhoneNumberI18NTest, PhoneNumbersMatch) { // Same numbers, defined country code. EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), ASCIIToUTF16("4158889999"), diff --git a/chrome/browser/autofill/select_control_handler_unittest.cc b/chrome/browser/autofill/select_control_handler_unittest.cc index a19e02a..2be54dc 100644 --- a/chrome/browser/autofill/select_control_handler_unittest.cc +++ b/chrome/browser/autofill/select_control_handler_unittest.cc @@ -8,10 +8,13 @@ #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/autofill/select_control_handler.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/form_field.h" -TEST(SelectControlHandlerTest, CreditCardMonthExact) { +typedef TestingBrowserProcessTest SelectControlHandlerTest; + +TEST_F(SelectControlHandlerTest, CreditCardMonthExact) { const char* const kMonthsNumeric[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", }; @@ -30,7 +33,7 @@ TEST(SelectControlHandlerTest, CreditCardMonthExact) { EXPECT_EQ(ASCIIToUTF16("01"), field.value); } -TEST(SelectControlHandlerTest, CreditCardMonthAbbreviated) { +TEST_F(SelectControlHandlerTest, CreditCardMonthAbbreviated) { const char* const kMonthsAbbreviated[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", @@ -50,7 +53,7 @@ TEST(SelectControlHandlerTest, CreditCardMonthAbbreviated) { EXPECT_EQ(ASCIIToUTF16("Jan"), field.value); } -TEST(SelectControlHandlerTest, CreditCardMonthFull) { +TEST_F(SelectControlHandlerTest, CreditCardMonthFull) { const char* const kMonthsFull[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", @@ -70,7 +73,7 @@ TEST(SelectControlHandlerTest, CreditCardMonthFull) { EXPECT_EQ(ASCIIToUTF16("January"), field.value); } -TEST(SelectControlHandlerTest, CreditCardMonthNumeric) { +TEST_F(SelectControlHandlerTest, CreditCardMonthNumeric) { const char* const kMonthsNumeric[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", }; @@ -89,7 +92,7 @@ TEST(SelectControlHandlerTest, CreditCardMonthNumeric) { EXPECT_EQ(ASCIIToUTF16("1"), field.value); } -TEST(SelectControlHandlerTest, AddressCountryFull) { +TEST_F(SelectControlHandlerTest, AddressCountryFull) { const char* const kCountries[] = { "Albania", "Canada" }; @@ -108,7 +111,7 @@ TEST(SelectControlHandlerTest, AddressCountryFull) { EXPECT_EQ(ASCIIToUTF16("Canada"), field.value); } -TEST(SelectControlHandlerTest, AddressCountryAbbrev) { +TEST_F(SelectControlHandlerTest, AddressCountryAbbrev) { const char* const kCountries[] = { "AL", "CA" }; @@ -127,7 +130,7 @@ TEST(SelectControlHandlerTest, AddressCountryAbbrev) { EXPECT_EQ(ASCIIToUTF16("CA"), field.value); } -TEST(SelectControlHandlerTest, AddressStateFull) { +TEST_F(SelectControlHandlerTest, AddressStateFull) { const char* const kStates[] = { "Alabama", "California" }; @@ -146,7 +149,7 @@ TEST(SelectControlHandlerTest, AddressStateFull) { EXPECT_EQ(ASCIIToUTF16("California"), field.value); } -TEST(SelectControlHandlerTest, AddressStateAbbrev) { +TEST_F(SelectControlHandlerTest, AddressStateAbbrev) { const char* const kStates[] = { "AL", "CA" }; @@ -165,7 +168,7 @@ TEST(SelectControlHandlerTest, AddressStateAbbrev) { EXPECT_EQ(ASCIIToUTF16("CA"), field.value); } -TEST(SelectControlHandlerTest, FillByValue) { +TEST_F(SelectControlHandlerTest, FillByValue) { const char* const kStates[] = { "Alabama", "California" }; @@ -187,7 +190,7 @@ TEST(SelectControlHandlerTest, FillByValue) { EXPECT_EQ(ASCIIToUTF16("California"), field.value); } -TEST(SelectControlHandlerTest, FillByContents) { +TEST_F(SelectControlHandlerTest, FillByContents) { const char* const kStates[] = { "Alabama", "California" }; diff --git a/chrome/browser/bookmarks/bookmark_codec_unittest.cc b/chrome/browser/bookmarks/bookmark_codec_unittest.cc index 4f82460..577fa42 100644 --- a/chrome/browser/bookmarks/bookmark_codec_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_codec_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/bookmarks/bookmark_model_test_utils.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/common/chrome_paths.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,7 +38,7 @@ BookmarkNode* AsMutable(const BookmarkNode* node) { } // namespace -class BookmarkCodecTest : public testing::Test { +class BookmarkCodecTest : public TestingBrowserProcessTest { protected: // Helpers to create bookmark models with different data. BookmarkModel* CreateTestModel1() { diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc index feb41db..48099ec 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/page_navigator.h" #include "grit/generated_resources.h" @@ -42,7 +43,7 @@ class TestingPageNavigator : public PageNavigator { std::vector<GURL> urls_; }; -class BookmarkContextMenuControllerTest : public testing::Test { +class BookmarkContextMenuControllerTest : public TestingBrowserProcessTest { public: BookmarkContextMenuControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/bookmarks/recently_used_folders_combo_model_unittest.cc b/chrome/browser/bookmarks/recently_used_folders_combo_model_unittest.cc index 5cc6009..f998ccd 100644 --- a/chrome/browser/bookmarks/recently_used_folders_combo_model_unittest.cc +++ b/chrome/browser/bookmarks/recently_used_folders_combo_model_unittest.cc @@ -7,10 +7,11 @@ #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -class RecentlyUsedFoldersComboModelTest : public testing::Test { +class RecentlyUsedFoldersComboModelTest : public TestingBrowserProcessTest { public: RecentlyUsedFoldersComboModelTest(); diff --git a/chrome/browser/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data_file_system_helper_unittest.cc index b79c8c3..8b9ff6b 100644 --- a/chrome/browser/browsing_data_file_system_helper_unittest.cc +++ b/chrome/browser/browsing_data_file_system_helper_unittest.cc @@ -46,7 +46,7 @@ typedef scoped_ptr<FileSystemInfoVector> ScopedFileSystemInfoVector; // called. For this to work, you'll need to ensure that each async call is // implemented as a class method that that calls Notify() at an appropriate // point. -class BrowsingDataFileSystemHelperTest : public testing::Test { +class BrowsingDataFileSystemHelperTest : public TestingBrowserProcessTest { public: BrowsingDataFileSystemHelperTest() : helper_(BrowsingDataFileSystemHelper::Create(&profile_)), diff --git a/chrome/browser/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data_remover_unittest.cc index 6814840..e18e02e 100644 --- a/chrome/browser/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data_remover_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" #include "chrome/browser/history/history.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util.h" @@ -150,7 +151,7 @@ class RemoveQuotaManagedDataTester : public BrowsingDataRemoverTester { // Test Class ---------------------------------------------------------------- -class BrowsingDataRemoverTest : public testing::Test { +class BrowsingDataRemoverTest : public TestingBrowserProcessTest { public: BrowsingDataRemoverTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/component_updater/component_updater_service_unittest.cc b/chrome/browser/component_updater/component_updater_service_unittest.cc index 414c889..d65904c 100644 --- a/chrome/browser/component_updater/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/component_updater_service_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/test_notification_tracker.h" #include "chrome/test/base/test_url_request_context_getter.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_observer.h" #include "content/common/notification_service.h" @@ -105,7 +106,7 @@ const char header_ok_reply[] = } // namespace // Common fixture for all the component updater tests. -class ComponentUpdaterTest : public testing::Test { +class ComponentUpdaterTest : public TestingBrowserProcessTest { public: ComponentUpdaterTest() : component_updater_(NULL) { // The component updater instance under test. diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc index 3a70196..552ae41 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc @@ -127,7 +127,7 @@ TEST_F(PolicyDefaultProviderTest, ObserveManagedSettingsChange) { provider.ShutdownOnUIThread(); } -class PolicyProviderTest : public testing::Test { +class PolicyProviderTest : public TestingBrowserProcessTest { public: PolicyProviderTest() : ui_thread_(BrowserThread::UI, &message_loop_) { diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index a869088..20f7080 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" #include "chrome/browser/mock_browsing_data_local_storage_helper.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "net/url_request/url_request_context.h" @@ -26,7 +27,7 @@ using ::testing::_; namespace { -class CookiesTreeModelTest : public testing::Test { +class CookiesTreeModelTest : public TestingBrowserProcessTest { public: CookiesTreeModelTest() : ui_thread_(BrowserThread::UI, &message_loop_), io_thread_(BrowserThread::IO, &message_loop_) { diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index c8b8170..dcd0829 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -188,7 +188,7 @@ class QueryProtocolHandlerOnChange : public NotificationObserver { NotificationRegistrar notification_registrar_; }; -class ProtocolHandlerRegistryTest : public testing::Test { +class ProtocolHandlerRegistryTest : public TestingBrowserProcessTest { protected: ProtocolHandlerRegistryTest() : test_protocol_handler_(CreateProtocolHandler("test", "test")) {} diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc index 25ad24e..18dabab 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/chrome/browser/download/download_manager_unittest.cc @@ -28,6 +28,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "grit/generated_resources.h" #include "testing/gmock/include/gmock/gmock.h" @@ -36,7 +37,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/bytes_formatting.h" -class DownloadManagerTest : public testing::Test { +class DownloadManagerTest : public TestingBrowserProcessTest { public: static const char* kTestData; static const size_t kTestDataLen; diff --git a/chrome/browser/download/download_safe_browsing_client_unittest.cc b/chrome/browser/download/download_safe_browsing_client_unittest.cc index 05bc36e..87a600a 100644 --- a/chrome/browser/download/download_safe_browsing_client_unittest.cc +++ b/chrome/browser/download/download_safe_browsing_client_unittest.cc @@ -5,6 +5,7 @@ #include "base/message_loop.h" #include "chrome/browser/download/download_safe_browsing_client.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,7 +32,7 @@ class MockSafeBrowsingService : public SafeBrowsingService { } // namespace -class DownloadSBClientTest : public testing::Test { +class DownloadSBClientTest : public TestingBrowserProcessTest { public: DownloadSBClientTest() : ui_thread_(BrowserThread::UI, &loop_) { diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index a607704..25801e8 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -16,7 +17,7 @@ // Our test class that takes care of managing the necessary threads for loading // extension icons, and waiting for those loads to happen. -class ExtensionIconManagerTest : public testing::Test { +class ExtensionIconManagerTest : public TestingBrowserProcessTest { public: ExtensionIconManagerTest() : unwaited_image_loads_(0), diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc index 7d14aff..5131355 100644 --- a/chrome/browser/extensions/extension_menu_manager_unittest.cc +++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc @@ -18,6 +18,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "testing/gmock/include/gmock/gmock.h" @@ -30,7 +31,7 @@ using testing::Return; using testing::SaveArg; // Base class for tests. -class ExtensionMenuManagerTest : public testing::Test { +class ExtensionMenuManagerTest : public TestingBrowserProcessTest { public: ExtensionMenuManagerTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index a1cdb4f..e77bd48 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_permission_set.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" @@ -45,7 +46,7 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { } // Base class for tests. -class ExtensionPrefsTest : public testing::Test { +class ExtensionPrefsTest : public TestingBrowserProcessTest { public: ExtensionPrefsTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 9194011..8d7ea1a 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -3254,6 +3254,8 @@ class ExtensionsReadyRecorder : public NotificationObserver { // Also tests that we always fire EXTENSIONS_READY, no matter whether we are // enabled or not. TEST(ExtensionServiceTestSimple, Enabledness) { + ScopedTestingBrowserProcess browser_process; + ExtensionErrorReporter::Init(false); // no noisy errors ExtensionsReadyRecorder recorder; scoped_ptr<TestingProfile> profile(new TestingProfile()); diff --git a/chrome/browser/extensions/extension_service_unittest.h b/chrome/browser/extensions/extension_service_unittest.h index 847fda5..9d6dee5 100644 --- a/chrome/browser/extensions/extension_service_unittest.h +++ b/chrome/browser/extensions/extension_service_unittest.h @@ -12,10 +12,11 @@ #include "base/message_loop.h" #include "base/scoped_temp_dir.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -class ExtensionServiceTestBase : public testing::Test { +class ExtensionServiceTestBase : public TestingBrowserProcessTest { public: ExtensionServiceTestBase(); virtual ~ExtensionServiceTestBase(); diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc index 34f2e70..bb3aa08 100644 --- a/chrome/browser/extensions/extension_updater_unittest.cc +++ b/chrome/browser/extensions/extension_updater_unittest.cc @@ -26,6 +26,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "libxml/globals.h" @@ -286,7 +287,7 @@ static void ExtractParameters(const std::string& params, // All of our tests that need to use private APIs of ExtensionUpdater live // inside this class (which is a friend to ExtensionUpdater). -class ExtensionUpdaterTest : public testing::Test { +class ExtensionUpdaterTest : public TestingBrowserProcessTest { public: static void SimulateTimerFired(ExtensionUpdater* updater) { EXPECT_TRUE(updater->timer_.IsRunning()); @@ -1040,20 +1041,19 @@ class ExtensionUpdaterTest : public testing::Test { // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F // subclasses where friendship with ExtenionUpdater is not inherited. -TEST(ExtensionUpdaterTest, TestExtensionUpdateCheckRequests) { +TEST_F(ExtensionUpdaterTest, TestExtensionUpdateCheckRequests) { ExtensionUpdaterTest::TestExtensionUpdateCheckRequests(false); } -TEST(ExtensionUpdaterTest, TestExtensionUpdateCheckRequestsPending) { +TEST_F(ExtensionUpdaterTest, TestExtensionUpdateCheckRequestsPending) { ExtensionUpdaterTest::TestExtensionUpdateCheckRequests(true); } -// This test is disabled on Mac, see http://crbug.com/26035. -TEST(ExtensionUpdaterTest, TestBlacklistUpdateCheckRequests) { +TEST_F(ExtensionUpdaterTest, TestBlacklistUpdateCheckRequests) { ExtensionUpdaterTest::TestBlacklistUpdateCheckRequests(); } -TEST(ExtensionUpdaterTest, TestUpdateUrlData) { +TEST_F(ExtensionUpdaterTest, TestUpdateUrlData) { MessageLoop message_loop; BrowserThread file_thread(BrowserThread::FILE, &message_loop); @@ -1066,39 +1066,38 @@ TEST(ExtensionUpdaterTest, TestUpdateUrlData) { Extension::GalleryUpdateUrl(true).spec()); } -TEST(ExtensionUpdaterTest, TestDetermineUpdates) { +TEST_F(ExtensionUpdaterTest, TestDetermineUpdates) { ExtensionUpdaterTest::TestDetermineUpdates(); } -TEST(ExtensionUpdaterTest, TestDetermineUpdatesPending) { +TEST_F(ExtensionUpdaterTest, TestDetermineUpdatesPending) { ExtensionUpdaterTest::TestDetermineUpdatesPending(); } -TEST(ExtensionUpdaterTest, TestMultipleManifestDownloading) { +TEST_F(ExtensionUpdaterTest, TestMultipleManifestDownloading) { ExtensionUpdaterTest::TestMultipleManifestDownloading(); } -TEST(ExtensionUpdaterTest, TestSingleExtensionDownloading) { +TEST_F(ExtensionUpdaterTest, TestSingleExtensionDownloading) { ExtensionUpdaterTest::TestSingleExtensionDownloading(false); } -TEST(ExtensionUpdaterTest, TestSingleExtensionDownloadingPending) { +TEST_F(ExtensionUpdaterTest, TestSingleExtensionDownloadingPending) { ExtensionUpdaterTest::TestSingleExtensionDownloading(true); } -// This test is disabled on Mac, see http://crbug.com/26035. -TEST(ExtensionUpdaterTest, TestBlacklistDownloading) { +TEST_F(ExtensionUpdaterTest, TestBlacklistDownloading) { ExtensionUpdaterTest::TestBlacklistDownloading(); } -TEST(ExtensionUpdaterTest, TestMultipleExtensionDownloadingUpdatesFail) { +TEST_F(ExtensionUpdaterTest, TestMultipleExtensionDownloadingUpdatesFail) { ExtensionUpdaterTest::TestMultipleExtensionDownloading(false); } -TEST(ExtensionUpdaterTest, TestMultipleExtensionDownloadingUpdatesSucceed) { +TEST_F(ExtensionUpdaterTest, TestMultipleExtensionDownloadingUpdatesSucceed) { ExtensionUpdaterTest::TestMultipleExtensionDownloading(true); } -TEST(ExtensionUpdaterTest, TestGalleryRequests) { +TEST_F(ExtensionUpdaterTest, TestGalleryRequests) { // We want to test a variety of combinations of expected ping conditions for // rollcall and active pings. int ping_cases[] = { ManifestFetchData::kNeverPinged, 0, 1, 5 }; @@ -1127,11 +1126,11 @@ TEST(ExtensionUpdaterTest, TestGalleryRequests) { } } -TEST(ExtensionUpdaterTest, TestHandleManifestResults) { +TEST_F(ExtensionUpdaterTest, TestHandleManifestResults) { ExtensionUpdaterTest::TestHandleManifestResults(); } -TEST(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { +TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { MessageLoop message_loop; BrowserThread file_thread(BrowserThread::FILE, &message_loop); @@ -1180,7 +1179,7 @@ TEST(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { EXPECT_FALSE(fetch->full_url().is_empty()); } -TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { +TEST_F(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { MessageLoop message_loop; BrowserThread ui_thread(BrowserThread::UI, &message_loop); BrowserThread file_thread(BrowserThread::FILE, &message_loop); @@ -1201,7 +1200,7 @@ TEST(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { updater.Stop(); } -TEST(ExtensionUpdaterTest, TestCheckSoon) { +TEST_F(ExtensionUpdaterTest, TestCheckSoon) { MessageLoop message_loop; BrowserThread ui_thread(BrowserThread::UI, &message_loop); BrowserThread file_thread(BrowserThread::FILE, &message_loop); diff --git a/chrome/browser/extensions/extension_webrequest_api_unittest.cc b/chrome/browser/extensions/extension_webrequest_api_unittest.cc index d1b34f2..8f84b08 100644 --- a/chrome/browser/extensions/extension_webrequest_api_unittest.cc +++ b/chrome/browser/extensions/extension_webrequest_api_unittest.cc @@ -16,6 +16,8 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/json_value_serializer.h" #include "net/base/net_util.h" #include "net/url_request/url_request_test_util.h" @@ -76,7 +78,7 @@ class TestIPCSender : public IPC::Message::Sender { SentMessages sent_messages_; }; -class ExtensionWebRequestTest : public testing::Test { +class ExtensionWebRequestTest : public TestingBrowserProcessTest { protected: virtual void SetUp() { event_router_ = new ExtensionEventRouterForwarder(); @@ -333,6 +335,7 @@ class ExtensionWebRequestHeaderModificationTest : context_->set_network_delegate(network_delegate_.get()); } + ScopedTestingBrowserProcess browser_process_; MessageLoopForIO io_loop_; TestingProfile profile_; TestDelegate delegate_; diff --git a/chrome/browser/extensions/external_policy_extension_loader_unittest.cc b/chrome/browser/extensions/external_policy_extension_loader_unittest.cc index bbed60a..3cfb8c2 100644 --- a/chrome/browser/extensions/external_policy_extension_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_extension_loader_unittest.cc @@ -15,10 +15,11 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -class ExternalPolicyExtensionProviderTest : public testing::Test { +class ExternalPolicyExtensionProviderTest : public TestingBrowserProcessTest { public: ExternalPolicyExtensionProviderTest() : loop_(MessageLoop::TYPE_IO), diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index 6e85d8a..5096f28 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/json_value_serializer.h" #include "content/common/notification_service.h" @@ -17,7 +18,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/size.h" -class ImageLoadingTrackerTest : public testing::Test, +class ImageLoadingTrackerTest : public TestingBrowserProcessTest, public ImageLoadingTracker::Observer { public: ImageLoadingTrackerTest() diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index 918ce39..78c4c12 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -14,6 +14,7 @@ #include "base/string_util.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -31,7 +32,7 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { // Test bringing up a master on a specific directory, putting a script // in there, etc. -class UserScriptMasterTest : public testing::Test, +class UserScriptMasterTest : public TestingBrowserProcessTest, public NotificationObserver { public: UserScriptMasterTest() diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc index 6a50672..c82e81f 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -59,7 +60,7 @@ void MockGeolocationSettingsObserver::Observe( GURL("http://foo.random-hostname.com/")); } -class GeolocationContentSettingsMapTests : public testing::Test { +class GeolocationContentSettingsMapTests : public TestingBrowserProcessTest { public: GeolocationContentSettingsMapTests() : ui_thread_(BrowserThread::UI, &message_loop_) { diff --git a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc index 238d21c..07330b2 100644 --- a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc +++ b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/geolocation/geolocation_settings_state.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -12,7 +13,7 @@ namespace { -class GeolocationSettingsStateTests : public testing::Test { +class GeolocationSettingsStateTests : public TestingBrowserProcessTest { public: GeolocationSettingsStateTests() : ui_thread_(BrowserThread::UI, &message_loop_) { diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index 6364fb3..01fbe964 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -25,6 +25,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/thumbnail_score.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -48,7 +49,7 @@ namespace history { // ExpireHistoryTest ----------------------------------------------------------- -class ExpireHistoryTest : public testing::Test, +class ExpireHistoryTest : public TestingBrowserProcessTest, public BroadcastNotificationDelegate { public: ExpireHistoryTest() diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 253698c..c3d1079 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/thumbnail_score.h" +#include "chrome/test/testing_browser_process_test.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -68,7 +69,7 @@ class HistoryBackendTestDelegate : public HistoryBackend::Delegate { DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); }; -class HistoryBackendTest : public testing::Test { +class HistoryBackendTest : public TestingBrowserProcessTest { public: HistoryBackendTest() : bookmark_model_(NULL), loaded_(false) {} virtual ~HistoryBackendTest() { diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc index 609f78a..ddf9394 100644 --- a/chrome/browser/history/history_querying_unittest.cc +++ b/chrome/browser/history/history_querying_unittest.cc @@ -10,6 +10,7 @@ #include "base/scoped_temp_dir.h" #include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" using base::Time; @@ -67,7 +68,7 @@ bool NthResultIs(const QueryResults& results, } // namespace -class HistoryQueryTest : public testing::Test { +class HistoryQueryTest : public TestingBrowserProcessTest { public: HistoryQueryTest() { } diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index a28d14c..1bf1332 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -45,6 +45,7 @@ #include "chrome/browser/history/page_usage_data.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/thumbnail_score.h" +#include "chrome/test/testing_browser_process_test.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -100,7 +101,7 @@ class BackendDelegate : public HistoryBackend::Delegate { // This must be outside the anonymous namespace for the friend statement in // HistoryBackend to work. -class HistoryTest : public testing::Test { +class HistoryTest : public TestingBrowserProcessTest { public: HistoryTest() : history_service_(NULL), diff --git a/chrome/browser/history/history_unittest_base.h b/chrome/browser/history/history_unittest_base.h index 1d9512d..80c72e9 100644 --- a/chrome/browser/history/history_unittest_base.h +++ b/chrome/browser/history/history_unittest_base.h @@ -6,12 +6,13 @@ #define CHROME_BROWSER_HISTORY_HISTORY_UNITTEST_BASE_H_ #include "base/file_util.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" namespace history { // A base class for a history unit test. It provides the common test methods. // -class HistoryUnitTestBase : public testing::Test { +class HistoryUnitTestBase : public TestingBrowserProcessTest { public: virtual ~HistoryUnitTestBase(); diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 3772ce7..cd99822 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -33,6 +33,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/password_form.h" @@ -51,7 +52,7 @@ #define MAYBE(x) x #endif -class ImporterTest : public testing::Test { +class ImporterTest : public TestingBrowserProcessTest { public: ImporterTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/instant/promo_counter_unittest.cc b/chrome/browser/instant/promo_counter_unittest.cc index a9b85be..2e694ed 100644 --- a/chrome/browser/instant/promo_counter_unittest.cc +++ b/chrome/browser/instant/promo_counter_unittest.cc @@ -4,9 +4,10 @@ #include "chrome/browser/instant/promo_counter.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" -typedef testing::Test PromoCounterTest; +typedef TestingBrowserProcessTest PromoCounterTest; // Makes sure ShouldShow returns false after the max number of days. TEST_F(PromoCounterTest, MaxTimeElapsed) { diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc index 24b9db4..8d6ac02 100644 --- a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc +++ b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_service.h" #include "content/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" @@ -147,8 +148,9 @@ TEST(GaiaOAuthFetcherTest, GetOAuthToken) { } #endif // 0 // Suppressing for now +typedef TestingBrowserProcessTest GaiaOAuthFetcherTest; -TEST(GaiaOAuthFetcherTest, OAuthGetAccessToken) { +TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) { const std::string oauth_token="1/OAuth1-Access_Token-1234567890abcdefghijklm"; const std::string oauth_token_secret="Dont_tell_the_secret-123"; const std::string data("oauth_token=" @@ -183,7 +185,7 @@ TEST(GaiaOAuthFetcherTest, OAuthGetAccessToken) { data); } -TEST(GaiaOAuthFetcherTest, OAuthWrapBridge) { +TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) { const std::string wrap_token="1/OAuth2-Access_Token-nopqrstuvwxyz1234567890"; const std::string expires_in="3600"; @@ -215,7 +217,7 @@ TEST(GaiaOAuthFetcherTest, OAuthWrapBridge) { data); } -TEST(GaiaOAuthFetcherTest, UserInfo) { +TEST_F(GaiaOAuthFetcherTest, UserInfo) { const std::string email_address="someone@somewhere.net"; const std::string wrap_token="1/OAuth2-Access_Token-nopqrstuvwxyz1234567890"; const std::string expires_in="3600"; diff --git a/chrome/browser/net/gaia/token_service_unittest.h b/chrome/browser/net/gaia/token_service_unittest.h index 6952dcd..f19983f 100644 --- a/chrome/browser/net/gaia/token_service_unittest.h +++ b/chrome/browser/net/gaia/token_service_unittest.h @@ -15,6 +15,7 @@ #include "chrome/test/base/signaling_task.h" #include "chrome/test/base/test_notification_tracker.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "testing/gtest/include/gtest/gtest.h" @@ -56,7 +57,7 @@ class TokenFailedTracker : public TestNotificationTracker { TokenService::TokenRequestFailedDetails details_; }; -class TokenServiceTestHarness : public testing::Test { +class TokenServiceTestHarness : public TestingBrowserProcessTest { public: TokenServiceTestHarness(); virtual ~TokenServiceTestHarness(); diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index f2f2eb2a..cebf3c2 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -18,6 +18,7 @@ #include "chrome/browser/notifications/notifications_prefs_cache.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -67,7 +68,7 @@ class MockBalloonCollection : public BalloonCollectionImpl { std::deque<Balloon*> balloons_; }; -class DesktopNotificationsTest : public testing::Test { +class DesktopNotificationsTest : public TestingBrowserProcessTest { public: DesktopNotificationsTest(); virtual ~DesktopNotificationsTest(); diff --git a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc index a52464a..0d709e2 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" using webkit_glue::PasswordForm; @@ -279,7 +280,7 @@ struct RunnableMethodTraits<NativeBackendGnome> { void ReleaseCallee(NativeBackendGnome*) {} }; -class NativeBackendGnomeTest : public testing::Test { +class NativeBackendGnomeTest : public TestingBrowserProcessTest { protected: NativeBackendGnomeTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/password_manager/password_form_manager_unittest.cc b/chrome/browser/password_manager/password_form_manager_unittest.cc index d8affba..8c63f40 100644 --- a/chrome/browser/password_manager/password_form_manager_unittest.cc +++ b/chrome/browser/password_manager/password_form_manager_unittest.cc @@ -10,11 +10,12 @@ #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "webkit/glue/password_form.h" using webkit_glue::PasswordForm; -class PasswordFormManagerTest : public testing::Test { +class PasswordFormManagerTest : public TestingBrowserProcessTest { public: PasswordFormManagerTest() { } diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index db6b8b0..5b93bc6 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/signaling_task.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" @@ -98,7 +99,7 @@ class DBThreadObserverHelper : typedef std::vector<PasswordForm*> VectorOfForms; -class PasswordStoreDefaultTest : public testing::Test { +class PasswordStoreDefaultTest : public TestingBrowserProcessTest { protected: PasswordStoreDefaultTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 7dd480e..8768584 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/signaling_task.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" @@ -316,6 +317,8 @@ class PasswordStoreXTest : public testing::TestWithParam<BackendType> { } } + ScopedTestingBrowserProcess browser_process_; + MessageLoopForUI message_loop_; BrowserThread ui_thread_; BrowserThread db_thread_; // PasswordStore, WDS schedule work on this thread. diff --git a/chrome/browser/plugin_exceptions_table_model_unittest.cc b/chrome/browser/plugin_exceptions_table_model_unittest.cc index b1cb814..2ee708b 100644 --- a/chrome/browser/plugin_exceptions_table_model_unittest.cc +++ b/chrome/browser/plugin_exceptions_table_model_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/models/table_model_observer.h" @@ -52,7 +53,7 @@ class MockTableModelObserver : public ui::TableModelObserver { using ::testing::InSequence; -class PluginExceptionsTableModelTest : public testing::Test { +class PluginExceptionsTableModelTest : public TestingBrowserProcessTest { public: PluginExceptionsTableModelTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc index 681f9b3..75a7e08 100644 --- a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc +++ b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc @@ -228,6 +228,8 @@ class CloudPolicySubsystemTestBase : public TESTBASE { << "No enough requests were fired during the test run."; } + ScopedTestingBrowserProcess browser_process_; + ScopedTempDir temp_user_data_dir_; MessageLoop loop_; diff --git a/chrome/browser/policy/device_management_service_unittest.cc b/chrome/browser/policy/device_management_service_unittest.cc index 0c3c242..3762269 100644 --- a/chrome/browser/policy/device_management_service_unittest.cc +++ b/chrome/browser/policy/device_management_service_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/policy/device_management_backend_mock.h" #include "chrome/browser/policy/device_management_service.h" #include "chrome/browser/policy/proto/device_management_constants.h" +#include "chrome/test/testing_browser_process.h" #include "content/browser/browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "net/base/escape.h" @@ -73,6 +74,8 @@ class DeviceManagementServiceTestBase : public TESTBASE { scoped_ptr<DeviceManagementBackend> backend_; private: + ScopedTestingBrowserProcess browser_process_; + MessageLoopForUI loop_; BrowserThread ui_thread_; BrowserThread io_thread_; diff --git a/chrome/browser/policy/user_policy_cache_unittest.cc b/chrome/browser/policy/user_policy_cache_unittest.cc index 426646a..161d4d6 100644 --- a/chrome/browser/policy/user_policy_cache_unittest.cc +++ b/chrome/browser/policy/user_policy_cache_unittest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/policy/proto/device_management_backend.pb.h" #include "chrome/browser/policy/proto/device_management_local.pb.h" #include "chrome/browser/policy/proto/old_generic_format.pb.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -44,7 +45,7 @@ class MockCloudPolicyCacheBaseObserver }; // Tests the device management policy cache. -class UserPolicyCacheTest : public testing::Test { +class UserPolicyCacheTest : public TestingBrowserProcessTest { protected: UserPolicyCacheTest() : loop_(MessageLoop::TYPE_UI), diff --git a/chrome/browser/prefs/pref_model_associator_unittest.cc b/chrome/browser/prefs/pref_model_associator_unittest.cc index 548bb08..2e83aa7 100644 --- a/chrome/browser/prefs/pref_model_associator_unittest.cc +++ b/chrome/browser/prefs/pref_model_associator_unittest.cc @@ -8,9 +8,10 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" -class AbstractPreferenceMergeTest : public testing::Test { +class AbstractPreferenceMergeTest : public TestingBrowserProcessTest { protected: virtual void SetUp() { pref_service_ = profile_.GetPrefs(); diff --git a/chrome/browser/prefs/pref_notifier_impl_unittest.cc b/chrome/browser/prefs/pref_notifier_impl_unittest.cc index 577a663..dfe4304 100644 --- a/chrome/browser/prefs/pref_notifier_impl_unittest.cc +++ b/chrome/browser/prefs/pref_notifier_impl_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_pref_service.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -54,7 +55,7 @@ class MockPrefNotifier : public PrefNotifierImpl { }; // Test fixture class. -class PrefNotifierTest : public testing::Test { +class PrefNotifierTest : public TestingBrowserProcessTest { protected: virtual void SetUp() { pref_service_.RegisterBooleanPref(kChangedPref, diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 6c50f1e..d2083c6 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/content_notification_types.h" #include "content/common/notification_details.h" @@ -142,7 +143,7 @@ class MockCloudPrintDataSenderHelper : public CloudPrintDataSenderHelper { const Value& arg2)); }; -class CloudPrintURLTest : public testing::Test { +class CloudPrintURLTest : public TestingBrowserProcessTest { public: CloudPrintURLTest() {} diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc index 4ca676c..9e34875 100644 --- a/chrome/browser/printing/print_job_unittest.cc +++ b/chrome/browser/printing/print_job_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/print_job_worker.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -80,13 +81,15 @@ class TestPrintNotifObserv : public NotificationObserver { virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - EXPECT_FALSE(true); + ADD_FAILURE(); } }; } // namespace -TEST(PrintJobTest, SimplePrint) { +typedef TestingBrowserProcessTest PrintJobTest; + +TEST_F(PrintJobTest, SimplePrint) { // Test the multi-threaded nature of PrintJob to make sure we can use it with // known lifetime. @@ -108,7 +111,7 @@ TEST(PrintJobTest, SimplePrint) { EXPECT_TRUE(check); } -TEST(PrintJobTest, SimplePrintLateInit) { +TEST_F(PrintJobTest, SimplePrintLateInit) { volatile bool check = false; MessageLoop current; scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); diff --git a/chrome/browser/renderer_host/web_cache_manager_unittest.cc b/chrome/browser/renderer_host/web_cache_manager_unittest.cc index 11b5b13..7713224 100644 --- a/chrome/browser/renderer_host/web_cache_manager_unittest.cc +++ b/chrome/browser/renderer_host/web_cache_manager_unittest.cc @@ -6,6 +6,7 @@ #include "base/message_loop.h" #include "chrome/browser/renderer_host/web_cache_manager.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -13,7 +14,7 @@ using base::Time; using base::TimeDelta; using WebKit::WebCache; -class WebCacheManagerTest : public testing::Test { +class WebCacheManagerTest : public TestingBrowserProcessTest { protected: typedef WebCacheManager::StatsMap StatsMap; typedef WebCacheManager::Allocation Allocation; diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index fbebf27..8510680 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/common/safe_browsing/client_model.pb.h" #include "chrome/common/safe_browsing/csd.pb.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" @@ -44,7 +45,7 @@ ACTION(QuitCurrentMessageLoop) { } } // namespace -class ClientSideDetectionServiceTest : public testing::Test { +class ClientSideDetectionServiceTest : public TestingBrowserProcessTest { protected: virtual void SetUp() { file_thread_.reset(new BrowserThread(BrowserThread::FILE, &msg_loop_)); diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc index d0fae59..1be52ec 100644 --- a/chrome/browser/search_engines/template_url_parser_unittest.cc +++ b/chrome/browser/search_engines/template_url_parser_unittest.cc @@ -9,9 +9,10 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_parser.h" #include "chrome/common/chrome_paths.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" -class TemplateURLParserTest : public testing::Test { +class TemplateURLParserTest : public TestingBrowserProcessTest { public: TemplateURLParserTest() : parse_result_(true) { } diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index ca675f0..0348259 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -14,10 +14,11 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "grit/theme_resources.h" #include "testing/gtest/include/gtest/gtest.h" -typedef testing::Test TemplateURLPrepopulateDataTest; +typedef TestingBrowserProcessTest TemplateURLPrepopulateDataTest; const int kCountryIds[] = { 'A'<<8|'D', 'A'<<8|'E', 'A'<<8|'F', 'A'<<8|'G', 'A'<<8|'I', diff --git a/chrome/browser/search_engines/template_url_service_test_util.h b/chrome/browser/search_engines/template_url_service_test_util.h index 4d119fc6..e3c050e 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.h +++ b/chrome/browser/search_engines/template_url_service_test_util.h @@ -14,6 +14,7 @@ #include "base/message_loop.h" #include "base/string16.h" #include "chrome/browser/search_engines/template_url_service_observer.h" +#include "chrome/test/testing_browser_process.h" #include "content/browser/browser_thread.h" class TemplateURLService; @@ -89,6 +90,8 @@ class TemplateURLServiceTestUtil : public TemplateURLServiceObserver { void StartIOThread(); private: + ScopedTestingBrowserProcess browser_process_; + MessageLoopForUI message_loop_; // Needed to make the DeleteOnUIThread trait of WebDataService work // properly. diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc index 8618577..ab6090c 100644 --- a/chrome/browser/search_engines/template_url_unittest.cc +++ b/chrome/browser/search_engines/template_url_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/rlz/rlz.h" #include "chrome/browser/search_engines/search_terms_data.h" #include "chrome/browser/search_engines/template_url.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" // Simple implementation of SearchTermsData. @@ -39,7 +40,7 @@ class TestSearchTermsData : public SearchTermsData { DISALLOW_COPY_AND_ASSIGN(TestSearchTermsData); }; -class TemplateURLTest : public testing::Test { +class TemplateURLTest : public TestingBrowserProcessTest { public: virtual void TearDown() { TemplateURLRef::SetGoogleBaseURL(NULL); diff --git a/chrome/browser/sync/abstract_profile_sync_service_test.h b/chrome/browser/sync/abstract_profile_sync_service_test.h index 7b5b34f..002cb53 100644 --- a/chrome/browser/sync/abstract_profile_sync_service_test.h +++ b/chrome/browser/sync/abstract_profile_sync_service_test.h @@ -14,6 +14,7 @@ #include "chrome/browser/net/gaia/token_service.h" #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/syncable/model_type.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,7 +38,7 @@ class ProfileSyncServiceTestHelper { browser_sync::TestIdFactory* ids); }; -class AbstractProfileSyncServiceTest : public testing::Test { +class AbstractProfileSyncServiceTest : public TestingBrowserProcessTest { public: AbstractProfileSyncServiceTest(); virtual ~AbstractProfileSyncServiceTest(); diff --git a/chrome/browser/sync/backend_migrator_unittest.cc b/chrome/browser/sync/backend_migrator_unittest.cc index bd9677b..0fdce83 100644 --- a/chrome/browser/sync/backend_migrator_unittest.cc +++ b/chrome/browser/sync/backend_migrator_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/browser/sync/sessions/session_state.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,7 +25,7 @@ using sessions::ErrorCounters; using sessions::SyncerStatus; using sessions::SyncSessionSnapshot; -class BackendMigratorTest : public testing::Test { +class BackendMigratorTest : public TestingBrowserProcessTest { public: BackendMigratorTest() { } virtual ~BackendMigratorTest() { } diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index 07a274d..f3f88e6 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -18,6 +18,7 @@ #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/content_notification_types.h" #include "content/common/notification_source.h" @@ -80,7 +81,7 @@ class SignalEventTask : public Task { WaitableEvent* done_event_; }; -class AutofillDataTypeControllerTest : public testing::Test { +class AutofillDataTypeControllerTest : public TestingBrowserProcessTest { public: AutofillDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc index 3d108f1..e034c3f 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" @@ -44,7 +45,7 @@ class BookmarkModelMock : public BookmarkModel { MOCK_CONST_METHOD0(IsLoaded, bool(void)); }; -class BookmarkDataTypeControllerTest : public testing::Test { +class BookmarkDataTypeControllerTest : public TestingBrowserProcessTest { public: BookmarkDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc index e21e680..17701e5 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" @@ -61,7 +62,7 @@ DataTypeManager::ConfigureStatus GetStatus( return result->status; } -class DataTypeManagerImplTest : public testing::Test { +class DataTypeManagerImplTest : public TestingBrowserProcessTest { public: DataTypeManagerImplTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/extension_data_type_controller_unittest.cc b/chrome/browser/sync/glue/extension_data_type_controller_unittest.cc index 1795f83..753d128 100644 --- a/chrome/browser/sync/glue/extension_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/extension_data_type_controller_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using browser_sync::ExtensionDataTypeController; @@ -32,7 +33,7 @@ class StartCallback { const tracked_objects::Location& location)); }; -class ExtensionDataTypeControllerTest : public testing::Test { +class ExtensionDataTypeControllerTest : public TestingBrowserProcessTest { public: ExtensionDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc index 0c358a5..5a8a1cf 100644 --- a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using browser_sync::ChangeProcessorMock; @@ -81,7 +82,7 @@ class FrontendDataTypeControllerFake : public FrontendDataTypeController { FrontendDataTypeControllerMock* mock_; }; -class FrontendDataTypeControllerTest : public testing::Test { +class FrontendDataTypeControllerTest : public TestingBrowserProcessTest { public: FrontendDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc index 3cd0780..a791e6e 100644 --- a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using base::WaitableEvent; @@ -110,7 +111,7 @@ class NonFrontendDataTypeControllerFake : public NonFrontendDataTypeController { NonFrontendDataTypeControllerMock* mock_; }; -class NonFrontendDataTypeControllerTest : public testing::Test { +class NonFrontendDataTypeControllerTest : public TestingBrowserProcessTest { public: NonFrontendDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/sync/glue/preference_data_type_controller_unittest.cc b/chrome/browser/sync/glue/preference_data_type_controller_unittest.cc index 170d595..9cb955a 100644 --- a/chrome/browser/sync/glue/preference_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/preference_data_type_controller_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using browser_sync::ChangeProcessorMock; @@ -33,7 +34,7 @@ class StartCallback { const tracked_objects::Location& location)); }; -class PreferenceDataTypeControllerTest : public testing::Test { +class PreferenceDataTypeControllerTest : public TestingBrowserProcessTest { public: PreferenceDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index eef2f37..25b6da7 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/test/base/test_url_request_context_getter.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" @@ -47,7 +48,7 @@ class MockSyncFrontend : public SyncFrontend { } // namespace -class SyncBackendHostTest : public testing::Test { +class SyncBackendHostTest : public TestingBrowserProcessTest { protected: SyncBackendHostTest() : ui_thread_(BrowserThread::UI, &ui_loop_), diff --git a/chrome/browser/sync/glue/theme_data_type_controller_unittest.cc b/chrome/browser/sync/glue/theme_data_type_controller_unittest.cc index 80b6b81..30b9beb 100644 --- a/chrome/browser/sync/glue/theme_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/theme_data_type_controller_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using browser_sync::ThemeDataTypeController; @@ -32,7 +33,7 @@ class StartCallback { const tracked_objects::Location& location)); }; -class ThemeDataTypeControllerTest : public testing::Test { +class ThemeDataTypeControllerTest : public TestingBrowserProcessTest { public: ThemeDataTypeControllerTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/glue/theme_util_unittest.cc b/chrome/browser/sync/glue/theme_util_unittest.cc index 3d728df..deaf38c 100644 --- a/chrome/browser/sync/glue/theme_util_unittest.cc +++ b/chrome/browser/sync/glue/theme_util_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -34,7 +35,7 @@ ProfileKeyedService* BuildMockThemeService(Profile* profile) { return new MockThemeService; } -class ThemeUtilTest : public testing::Test { +class ThemeUtilTest : public TestingBrowserProcessTest { protected: MockThemeService* BuildForProfile(Profile* profile) { return static_cast<MockThemeService*>( diff --git a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc index 448c583..4352cf7 100644 --- a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc @@ -15,11 +15,12 @@ #include "chrome/browser/sync/profile_sync_factory_impl.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" using browser_sync::DataTypeController; -class ProfileSyncFactoryImplTest : public testing::Test { +class ProfileSyncFactoryImplTest : public TestingBrowserProcessTest { protected: ProfileSyncFactoryImplTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc index 01271a1..c627764 100644 --- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc @@ -30,6 +30,7 @@ #include "chrome/test/base/testing_profile.h" #include "chrome/test/sync/engine/test_id_factory.h" #include "chrome/test/sync/engine/test_user_share.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -277,7 +278,7 @@ class MockUnrecoverableErrorHandler : public UnrecoverableErrorHandler { void(const tracked_objects::Location&, const std::string&)); }; -class ProfileSyncServiceBookmarkTest : public testing::Test { +class ProfileSyncServiceBookmarkTest : public TestingBrowserProcessTest { protected: enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE }; enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE }; diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 92ac816..ee2ef81 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" @@ -37,7 +38,7 @@ ACTION_P(InvokeCallback, callback_result) { } // TODO(chron): Test not using cros_user flag and use signin_ -class ProfileSyncServiceStartupTest : public testing::Test { +class ProfileSyncServiceStartupTest : public TestingBrowserProcessTest { public: ProfileSyncServiceStartupTest() : ui_thread_(BrowserThread::UI, &ui_loop_), diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index bd55a12..971f96d 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -18,6 +18,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,7 +38,7 @@ using testing::AtMost; using testing::Return; using testing::StrictMock; -class ProfileSyncServiceTest : public testing::Test { +class ProfileSyncServiceTest : public TestingBrowserProcessTest { protected: ProfileSyncServiceTest() : ui_thread_(BrowserThread::UI, &ui_loop_), diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index 3feced7..1d0c407 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/tab_contents/thumbnail_generator.h" #include "chrome/common/render_messages.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/renderer_host/backing_store_manager.h" #include "content/browser/renderer_host/backing_store_skia.h" #include "content/browser/renderer_host/mock_render_process_host.h" @@ -53,7 +54,7 @@ class TestRenderWidgetHostViewWithBackingStoreSkia DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetHostViewWithBackingStoreSkia); }; -class ThumbnailGeneratorTest : public testing::Test { +class ThumbnailGeneratorTest : public TestingBrowserProcessTest { public: ThumbnailGeneratorTest() { profile_.reset(new TestingProfile()); @@ -207,12 +208,14 @@ TEST_F(ThumbnailGeneratorTest, DiscardBackingStore) { #endif // !defined(OS_MAC) -TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_Empty) { +typedef TestingBrowserProcessTest ThumbnailGeneratorSimpleTest; + +TEST_F(ThumbnailGeneratorSimpleTest, CalculateBoringScore_Empty) { SkBitmap bitmap; EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(&bitmap)); } -TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { +TEST_F(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { const SkColor kBlack = SkColorSetRGB(0, 0, 0); const gfx::Size kSize(20, 10); gfx::CanvasSkia canvas(kSize.width(), kSize.height(), true); @@ -224,7 +227,7 @@ TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(&bitmap)); } -TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { +TEST_F(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { const SkColor kBlack = SkColorSetRGB(0, 0, 0); const SkColor kWhite = SkColorSetRGB(0xFF, 0xFF, 0xFF); const gfx::Size kSize(20, 10); @@ -242,7 +245,7 @@ TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { EXPECT_DOUBLE_EQ(0.5, ThumbnailGenerator::CalculateBoringScore(&bitmap)); } -TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { +TEST_F(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { // The input bitmap is vertically long. gfx::CanvasSkia canvas(40, 90, true); const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); @@ -258,7 +261,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { EXPECT_EQ(ThumbnailGenerator::kTallerThanWide, clip_result); } -TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { +TEST_F(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { // The input bitmap is horizontally long. gfx::CanvasSkia canvas(90, 40, true); const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); @@ -274,7 +277,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { EXPECT_EQ(ThumbnailGenerator::kWiderThanTall, clip_result); } -TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { +TEST_F(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { // The input bitmap is square. gfx::CanvasSkia canvas(40, 40, true); const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); @@ -290,7 +293,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { EXPECT_EQ(ThumbnailGenerator::kNotClipped, clip_result); } -TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NonSquareOutput) { +TEST_F(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NonSquareOutput) { // The input bitmap is square. gfx::CanvasSkia canvas(40, 40, true); const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); @@ -343,7 +346,7 @@ class MockTopSites : public history::TopSites { std::map<std::string, ThumbnailScore> known_url_map_; }; -TEST(ThumbnailGeneratorSimpleTest, ShouldUpdateThumbnail) { +TEST_F(ThumbnailGeneratorSimpleTest, ShouldUpdateThumbnail) { const GURL kGoodURL("http://www.google.com/"); const GURL kBadURL("chrome://newtab"); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc index 715147f..ea18968 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,7 +23,7 @@ class EmptyTabstripOriginProvider : public TabstripOriginProvider { } }; -class BookmarkBarGtkUnittest : public ::testing::Test { +class BookmarkBarGtkUnittest : public TestingBrowserProcessTest { protected: BookmarkBarGtkUnittest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc index c8a0a0a..990d8b4 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,7 +25,7 @@ using bookmark_utils::GetTitleFromTreeIter; // GTK-ifications of the corresponding views tests. Testing here is really // important because on Linux, we make round trip copies from chrome's // BookmarkModel class to GTK's native GtkTreeStore. -class BookmarkEditorGtkTest : public testing::Test { +class BookmarkEditorGtkTest : public TestingBrowserProcessTest { public: BookmarkEditorGtkTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc b/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc index e1099af..835fc8a 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "grit/theme_resources.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,7 +24,7 @@ SkColor GdkToSkColor(GdkColor* color) { } // namespace -class GtkThemeServiceTest : public testing::Test { +class GtkThemeServiceTest : public TestingBrowserProcessTest { public: GtkThemeServiceTest() : provider_(NULL) {} diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc index 36c6a52..217b83c 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc +++ b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,7 +27,7 @@ static const string16 kB1(ASCIIToUTF16("b1")); // Base class for keyword editor tests. Creates a profile containing an // empty TemplateURLService. -class KeywordEditorControllerTest : public testing::Test, +class KeywordEditorControllerTest : public TestingBrowserProcessTest, public ui::TableModelObserver { public: // Initializes all of the state. diff --git a/chrome/browser/ui/toolbar/encoding_menu_controller_unittest.cc b/chrome/browser/ui/toolbar/encoding_menu_controller_unittest.cc index a49f7d4..444e971 100644 --- a/chrome/browser/ui/toolbar/encoding_menu_controller_unittest.cc +++ b/chrome/browser/ui/toolbar/encoding_menu_controller_unittest.cc @@ -12,10 +12,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "testing/gtest/include/gtest/gtest.h" - -class EncodingMenuControllerTest : public testing::Test { +class EncodingMenuControllerTest : public TestingBrowserProcessTest { }; TEST_F(EncodingMenuControllerTest, EncodingIDsBelongTest) { diff --git a/chrome/browser/ui/webui/theme_source_unittest.cc b/chrome/browser/ui/webui/theme_source_unittest.cc index 0e358a0..568c214 100644 --- a/chrome/browser/ui/webui/theme_source_unittest.cc +++ b/chrome/browser/ui/webui/theme_source_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/ui/webui/theme_source.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -33,7 +34,7 @@ class MockThemeSource : public ThemeSource { ~MockThemeSource() {} }; -class WebUISourcesTest : public testing::Test { +class WebUISourcesTest : public TestingBrowserProcessTest { public: WebUISourcesTest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} diff --git a/chrome/browser/user_style_sheet_watcher_unittest.cc b/chrome/browser/user_style_sheet_watcher_unittest.cc index 8c729a1..b1154c9 100644 --- a/chrome/browser/user_style_sheet_watcher_unittest.cc +++ b/chrome/browser/user_style_sheet_watcher_unittest.cc @@ -11,10 +11,13 @@ #include "base/scoped_temp_dir.h" #include "base/string_util.h" #include "base/threading/thread.h" +#include "chrome/test/testing_browser_process.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" TEST(UserStyleSheetWatcherTest, StyleLoad) { + ScopedTestingBrowserProcess browser_process; + ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc index c3420a0..db30402 100644 --- a/chrome/browser/visitedlink/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink/visitedlink_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/common/render_messages.h" #include "chrome/renderer/visitedlink_slave.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/test_render_view_host.h" @@ -72,7 +73,7 @@ class TrackingVisitedLinkEventListener : public VisitedLinkMaster::Listener { int add_count_; }; -class VisitedLinkTest : public testing::Test { +class VisitedLinkTest : public TestingBrowserProcessTest { protected: VisitedLinkTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/webdata/autofill_table_unittest.cc b/chrome/browser/webdata/autofill_table_unittest.cc index f954e7b..68ebd1c 100644 --- a/chrome/browser/webdata/autofill_table_unittest.cc +++ b/chrome/browser/webdata/autofill_table_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/guid.h" +#include "chrome/test/testing_browser_process_test.h" #include "sql/statement.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/form_field.h" @@ -81,7 +82,7 @@ bool CompareAutofillEntries(const AutofillEntry& a, const AutofillEntry& b) { } // anonymous namespace -class AutofillTableTest : public testing::Test { +class AutofillTableTest : public TestingBrowserProcessTest { public: AutofillTableTest() {} virtual ~AutofillTableTest() {} diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index 7a32881..e242587 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -29,6 +29,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/guid.h" #include "chrome/test/base/thread_observer_helper.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" @@ -68,7 +69,7 @@ class AutofillDBThreadObserverHelper : public DBThreadObserverHelper { } }; -class WebDataServiceTest : public testing::Test { +class WebDataServiceTest : public TestingBrowserProcessTest { public: WebDataServiceTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/webdata/web_database_migration_unittest.cc b/chrome/browser/webdata/web_database_migration_unittest.cc index e6e7355..29554e4 100644 --- a/chrome/browser/webdata/web_database_migration_unittest.cc +++ b/chrome/browser/webdata/web_database_migration_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/guid.h" #include "chrome/test/base/ui_test_utils.h" +#include "chrome/test/testing_browser_process_test.h" #include "sql/statement.h" #include "testing/gtest/include/gtest/gtest.h" @@ -127,7 +128,7 @@ void CreditCard32FromStatement(const sql::Statement& s, // Specifically, these tests are intended to exercise any schema changes in // the WebDatabase and data migrations that occur in // |WebDatabase::MigrateOldVersionsAsNeeded()|. -class WebDatabaseMigrationTest : public testing::Test { +class WebDatabaseMigrationTest : public TestingBrowserProcessTest { public: WebDatabaseMigrationTest() {} virtual ~WebDatabaseMigrationTest() {} diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc index df52a15..596cf16 100644 --- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc +++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" @@ -60,7 +61,7 @@ void MockFetcher::Start() { } -class GaiaAuthFetcherTest : public testing::Test { +class GaiaAuthFetcherTest : public TestingBrowserProcessTest { public: GaiaAuthFetcherTest() : client_login_source_(GaiaUrls::GetInstance()->client_login_url()), diff --git a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc index d204a79..e3e2a9f 100644 --- a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc +++ b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/common/net/gaia/gaia_oauth_client.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" +#include "chrome/test/testing_browser_process_test.h" #include "content/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" @@ -123,7 +124,7 @@ const std::string kDummyRefreshTokenResult = namespace gaia { -class GaiaOAuthClientTest : public testing::Test { +class GaiaOAuthClientTest : public TestingBrowserProcessTest { public: GaiaOAuthClientTest() {} |