Index: chrome/browser/ui/views/first_run_bubble_unittest.cc |
diff --git a/chrome/browser/ui/views/first_run_bubble_unittest.cc b/chrome/browser/ui/views/first_run_bubble_unittest.cc |
index d5f9386c68be52eaedb5484261bb37e015492caf..83c1b9c1f2b339b4325748a2b1ff66dd6e7f7f3d 100644 |
--- a/chrome/browser/ui/views/first_run_bubble_unittest.cc |
+++ b/chrome/browser/ui/views/first_run_bubble_unittest.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/search_engines/template_url_service_factory.h" |
#include "chrome/browser/ui/views/first_run_bubble.h" |
+#include "chrome/test/base/testing_browser_process.h" |
#include "chrome/test/base/testing_profile.h" |
#include "components/search_engines/template_url.h" |
#include "components/search_engines/template_url_service.h" |
@@ -19,12 +20,13 @@ class FirstRunBubbleTest : public views::ViewsTestBase { |
// Overrides from views::ViewsTestBase: |
void SetUp() override; |
+ void TearDown() override; |
protected: |
- TestingProfile* profile() { return &profile_; } |
+ TestingProfile* profile() { return profile_.get(); } |
private: |
- TestingProfile profile_; |
+ scoped_ptr<TestingProfile> profile_; |
DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest); |
}; |
@@ -34,13 +36,20 @@ FirstRunBubbleTest::~FirstRunBubbleTest() {} |
void FirstRunBubbleTest::SetUp() { |
ViewsTestBase::SetUp(); |
+ profile_.reset(new TestingProfile()); |
TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
- &profile_, &TemplateURLServiceFactory::BuildInstanceFor); |
+ profile_.get(), &TemplateURLServiceFactory::BuildInstanceFor); |
TemplateURLService* turl_model = |
- TemplateURLServiceFactory::GetForProfile(&profile_); |
+ TemplateURLServiceFactory::GetForProfile(profile_.get()); |
turl_model->Load(); |
} |
+void FirstRunBubbleTest::TearDown() { |
+ ViewsTestBase::TearDown(); |
+ profile_.reset(); |
+ TestingBrowserProcess::DeleteInstance(); |
+} |
+ |
TEST_F(FirstRunBubbleTest, CreateAndClose) { |
// Create the anchor and parent widgets. |
views::Widget::InitParams params = |