Index: chrome/browser/profile_resetter/profile_resetter_unittest.cc |
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc |
index 64ad49168efa9fcf76149a80c864cda375b3102a..d044ad9f79fd46c98988f35cb375c448da15644f 100644 |
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc |
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc |
@@ -7,6 +7,8 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
#include "base/message_loop.h" |
+#include "chrome/browser/search_engines/template_url_service_test_util.h" |
+#include "chrome/test/base/testing_profile.h" |
#include "content/public/test/test_browser_thread.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -19,24 +21,36 @@ class MockObject { |
class ProfileResetterTest : public testing::Test { |
public: |
- ProfileResetterTest() |
- : ui_thread_(content::BrowserThread::UI, &message_loop_), |
- resetter_(NULL) {} |
battre
2013/05/22 14:03:37
I think that we should actually go in the opposite
vasilii
2013/05/22 18:54:08
I modified the tests in another way.
|
+ ProfileResetterTest() { |
+ } |
- ~ProfileResetterTest() {} |
+ // testing::Test |
+ virtual void SetUp(); |
+ virtual void TearDown(); |
- private: |
- base::MessageLoopForUI message_loop_; |
- content::TestBrowserThread ui_thread_; |
+ ~ProfileResetterTest() {} |
protected: |
testing::StrictMock<MockObject> mock_object_; |
- ProfileResetter resetter_; |
+ TemplateURLServiceTestUtil test_util_; |
+ scoped_ptr<ProfileResetter> resetter_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ProfileResetterTest); |
}; |
+void ProfileResetterTest::SetUp() { |
+ test_util_.SetUp(); |
+ resetter_.reset(new ProfileResetter(test_util_.profile())); |
+} |
+ |
+void ProfileResetterTest::TearDown() { |
+ test_util_.TearDown(); |
+} |
+ |
TEST_F(ProfileResetterTest, ResetDefaultSearchEngine) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ test_util_.VerifyLoad(); |
+ resetter_->Reset( |
ProfileResetter::DEFAULT_SEARCH_ENGINE, |
ProfileResetter::DISABLE_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -44,7 +58,7 @@ TEST_F(ProfileResetterTest, ResetDefaultSearchEngine) { |
TEST_F(ProfileResetterTest, ResetHomepage) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ resetter_->Reset( |
ProfileResetter::HOMEPAGE, |
ProfileResetter::DISABLE_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -52,7 +66,7 @@ TEST_F(ProfileResetterTest, ResetHomepage) { |
TEST_F(ProfileResetterTest, ResetContentSettings) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ resetter_->Reset( |
ProfileResetter::CONTENT_SETTINGS, |
ProfileResetter::DISABLE_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -60,7 +74,7 @@ TEST_F(ProfileResetterTest, ResetContentSettings) { |
TEST_F(ProfileResetterTest, ResetCookiesAndSiteData) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ resetter_->Reset( |
ProfileResetter::COOKIES_AND_SITE_DATA, |
ProfileResetter::DISABLE_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -68,7 +82,7 @@ TEST_F(ProfileResetterTest, ResetCookiesAndSiteData) { |
TEST_F(ProfileResetterTest, ResetExtensionsByDisabling) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ resetter_->Reset( |
ProfileResetter::EXTENSIONS, |
ProfileResetter::DISABLE_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -76,7 +90,7 @@ TEST_F(ProfileResetterTest, ResetExtensionsByDisabling) { |
TEST_F(ProfileResetterTest, ResetExtensionsByUninstalling) { |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ resetter_->Reset( |
ProfileResetter::EXTENSIONS, |
ProfileResetter::UNINSTALL_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |
@@ -85,7 +99,8 @@ TEST_F(ProfileResetterTest, ResetExtensionsByUninstalling) { |
TEST_F(ProfileResetterTest, ResetExtensionsAll) { |
// mock_object_ is a StrictMock, so we verify that it is called only once. |
EXPECT_CALL(mock_object_, Callback()); |
- resetter_.Reset( |
+ test_util_.VerifyLoad(); |
+ resetter_->Reset( |
ProfileResetter::ALL, |
ProfileResetter::UNINSTALL_EXTENSIONS, |
base::Bind(&MockObject::Callback, base::Unretained(&mock_object_))); |